I have a Template Column under which I have Placed a Dropdownlist. Now I would Like to get the selectedRow of the datagrid on selectedIndeChanged event of the dropdownlist that's inside the template Column
views:
650answers:
2
+1
A:
You can get the index of the item in the datagrid, by looking at the DataGridItem your dropdownlist is contained within.
Assuming your DropDownList is directly in the TemplateColumn and is not wrapped by other elements, then the following example shows how to do this:
protected void DropDown_SelectedIndexChanged(object sender, object eventdata)
{
int gridRowIndex = ((DataGridItem)((DropDownList)sender).Parent.Parent).ItemIndex;
}
Tom Jelen
2008-12-12 08:03:13
A:
Does DataGrid1.SelectedIndex help?
DataGrid1 = Name of the variable that is the name of the DataGrid control on the page.
shahkalpesh
2008-12-12 08:11:22