Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set selected value for dropdown list in gridview template

Status
Not open for further replies.

stonehead

Technical User
May 2, 2007
58
US
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
 
What is triggering Sub btnEditRecord?

Are you clicking the edit button in a gridview row?


We need more info in order to help you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top