now on the Row Editing event i need to get the selected value of dropdownlist of country and then i will set that value as Ddlcountry.selectedvalue=value; so that when dropdownlist of edit item template appears it will show the selected value not the 0 index of dropdownlist. Data Bind() Drop Down List Ddl Country = Grid View1.
event is raised when a row's Edit button is clicked, but before the Grid View control enters edit mode.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. This enables you to provide an event-handling method that performs a custom routine, such as canceling the edit operation, whenever this event occurs.A Grid View Edit Event Args object is passed to the event-handling method, which enables you to determine the index of the current row and to indicate that the edit operation should be canceled.