Find Control("cbmanager1") If Not cbmanager Is Nothing Then cbmanager. Add(New List Item("Test1", "Test1")) End If This won't work in the Row Editing event. Thanks bro Dude i corrected that error it was just a naming problem but now Bro all is well but now the first element in the dropdownlist is getting rewritten to the label value man when in edit mode (i.e)I have repetition of one element and also losing another. To String();these two lines showed error removing these two lines i executed and got the output dude.Protected Sub Page_Load(By Val sender As Object, By Val e As System. Load If Not Is Post Back Then Show GV() End If End Sub Protected Sub gv Info_Row Editing(By Val sender As Object, By Val e As System. Net) forum i found that developers ask how to enable or disable or show or hide server side controls like textbox, label, checkbox, checkboxlist, radiobutton, radiobuttonlist & dropdownlist or combo box in Grid View edit mode. Everyone using Row Editing event handler by using findcontrol method and editindex number. Name Brand" & " FROM Product P, Brand B" & " WHERE P. ID" Dim s Constr As String = Configuration Manager. Connection String Using conn As New Sql Connection(s Constr) Using comm As New Sql Command(SQL, conn) conn. Data Bind() End Sub 0 Then Dim cbo Brand As Drop Down List = Direct Cast(e. Find Control("cbo Brand"), Drop Down List) Dim dt As Data Table Dim SQL As [String] = "SELECT * FROM Brand" Dim s Constr As String = Configuration Manager. Connection String Using conn As New Sql Connection(s Constr) Using comm As New Sql Command(SQL, conn) conn. This enables you to provide an event-handling method that performs a custom routine, such as canceling the edit operation, whenever this event occurs.
Data Bind() ' Got rid of the bound field in the end and did it with a templatefield so needed to get the department from the label Dim lbl As Label = e.
I am able to access the dropdown in the Item Data Bound event.
Data Row Then Dim lbl Manager1 As Label = Direct Cast(e. Find Control("lbl Manager1"), Label) Dim lbl Manager2 As Label = Direct Cast(e. Find Control("lbl Manager2"), Label) Dim e Handler As Employee Handler = New Employee Handler Dim dept Cell As Table Cell = e. Cells(0) Dim dept As Department = New Department dept. Text Dim mgr1 As Manager = e Manager1(dept) Dim mgr2 As Manager = e Manager2(dept) lbl Manager1. Get Manager List ' Get the department name from the Bound Field Dim dept Cell As Table Cell = gv Chain. I have tried the below but this is giving a Null Reference Exception: Dim cb Manager1 As Drop Down List = Try Cast(gv Chain.
Row Editing event occurs on clicking the edit button but before the Grid View goes into edit mode.
I have been doing some more research and it seems I'm barking up the wrong tree.