All,
This is what I currently have; and the error I got is
"Object reference not set to an instance of object" for line
myDDL.Items.FindByValue("strStatus").Selected = True
Please help me.
Protected Sub btnEditRecord(ByVal sender As Object, ByVal e As System.EventArgs)
gvDetailDatabind(gvEditRecord)
strStatus = gvStaffView.Rows(0).Cells(4).Text
Dim myDDL As New DropDownList
myDDL = CType(gvEditRecord.FindControl("ddStatus"), DropDownList)
myDDL.Items.FindByValue("strStatus").Selected = True
gvEditRecord.Visible = True
End Sub
This is what I currently have; and the error I got is
"Object reference not set to an instance of object" for line
myDDL.Items.FindByValue("strStatus").Selected = True
Please help me.
Protected Sub btnEditRecord(ByVal sender As Object, ByVal e As System.EventArgs)
gvDetailDatabind(gvEditRecord)
strStatus = gvStaffView.Rows(0).Cells(4).Text
Dim myDDL As New DropDownList
myDDL = CType(gvEditRecord.FindControl("ddStatus"), DropDownList)
myDDL.Items.FindByValue("strStatus").Selected = True
gvEditRecord.Visible = True
End Sub