Get SelectedRow from DataGrid in dropdown_SelectedIndexChanged event ASP.Net, C #
2 answers
You can get the index of an item in the datagrid by looking at the DataGridItem the dropdown is in.
Assuming your DropDownList is directly in the TemplateColumn and not wrapped with other elements, the following example shows how to do this:
protected void DropDown_SelectedIndexChanged(object sender, object eventdata)
{
int gridRowIndex = ((DataGridItem)((DropDownList)sender).Parent.Parent).ItemIndex;
}
+1
source to share