มันเอเล่อร์ object reference not set to an instance of an object. ตอนส่งค่าแล้วกดค้นหาใน rowdataboundของddlcom Code (VB.NET)
Private Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
Dim DDlCom As DropDownList
DDlCom = e.Row.FindControl("DdlCom")
Dim Myda1 As New SqlDataAdapter("Select Code From Tl_ComponentCode order by code", Conn)
Dim ds1 As New DataSet
ds1.Clear()
Myda1.Fill(ds1, "datacom")
If ds1.Tables("datacom").Rows.Count > 0 Then
With DDlCom
[font=Verdana] .DataSource = ds1.Tables("datacom")[/font]
.DataTextField = "Code"
.DataValueField = "Code"
.DataBind()
End With
End If
Dim DdlDmg As DropDownList
DdlDmg = e.Row.FindControl("DdlDmg")
Dim Myda2 As New SqlDataAdapter("Select Code_Da From Tl_DamageCode order by Code_Da", Conn)
Dim ds2 As New DataSet
Myda2.Fill(ds2, "dataDMG")
If ds2.Tables("dataDMG").Rows.Count > 0 Then
With DdlDmg
.DataSource = ds2.Tables("dataDMG")
.DataTextField = "Code_Da"
.DataValueField = "Code_Da"
.DataBind()
End With
End If
Dim DdlRepair As DropDownList
DdlRepair = e.Row.FindControl("DdlRepair")
Dim Myda3 As New SqlDataAdapter("Select Code_Repair From Tl_RepairCode order by Code_Repair", Conn)
Dim ds3 As New DataSet
Myda3.Fill(ds3, "dataRep")
If ds3.Tables("dataRep").Rows.Count > 0 Then
With DdlRepair
.DataSource = ds3.Tables("dataRep")
.DataTextField = "Code_Repair"
.DataValueField = "Code_Repair"
.DataBind()
End With
End If
End Sub