Hi All,
I have populated my dropdownlist of gridview in row_created event as
**************************************************
sqlcmd.CommandText = sQry
Dim DataR As SqlDataReader
DataR = sqlcmd.ExecuteReader
If ddl IsNot Nothing Then
While (DataR.Read())
ddl.Items.Insert(0, New ListItem(DataR("AcctName"), DataR("U_GLCode")))
End While
End If
****************************************************
and i have bound the dropdownlist as
text='<%# DataBinder.Eval(Container,"DataItem.ExpHead") %>'
****************************************************
in button click i get error as "Object Reference Not Set to an Instance of Object"
when i try to use the below code (Underline Marked at the point of error)
****************************************************
For Each GvRow In GridV.Rows
Dim ddl As DropDownList
ddl = DirectCast(GvRow.FindControl("ddlExpHead"), DropDownList)
sQry = "Update [@OEMS_Claim] set U_ExpHeadCode='" & ddl.SelectedItem.Value & "' where U_Code='" & lblClaimNo.Text & "' and U_LineNo='" & GvRow.Cells(0).Text & "'"
Next
****************************************************
Pls help, bit urgent
Regards
Suresh G
I have populated my dropdownlist of gridview in row_created event as
**************************************************
sqlcmd.CommandText = sQry
Dim DataR As SqlDataReader
DataR = sqlcmd.ExecuteReader
If ddl IsNot Nothing Then
While (DataR.Read())
ddl.Items.Insert(0, New ListItem(DataR("AcctName"), DataR("U_GLCode")))
End While
End If
****************************************************
and i have bound the dropdownlist as
text='<%# DataBinder.Eval(Container,"DataItem.ExpHead") %>'
****************************************************
in button click i get error as "Object Reference Not Set to an Instance of Object"
when i try to use the below code (Underline Marked at the point of error)
****************************************************
For Each GvRow In GridV.Rows
Dim ddl As DropDownList
ddl = DirectCast(GvRow.FindControl("ddlExpHead"), DropDownList)
sQry = "Update [@OEMS_Claim] set U_ExpHeadCode='" & ddl.SelectedItem.Value & "' where U_Code='" & lblClaimNo.Text & "' and U_LineNo='" & GvRow.Cells(0).Text & "'"
Next
****************************************************
Pls help, bit urgent
Regards
Suresh G