How to access a DropDownList in the GridView row programmatically in the RowDataBound event handler

protected void EditTitleGridView_OnRowDataBound(object sender, GridViewRowEventArgs e)

{

// get the grid row from the event handler arguement

GridViewRow row = e.Row;

//  here is how you get the data row (if you were curious)

DataRowView dr = row.DataItem as DataRowView;

 

// now find the control in the row by control ID

DropDownList myDropDown = row.FindControl("MyDropDown") as DropDownList;

Ebook Download
View all
Learn
View all