My experience is in using a table instead of a datagrid so I donât know if it can be done in a datagrid or if you will have to resort to a DataList or DataTable but I am hoping you can glean something from it in either case. What I did was created a new control that inherited from the dropdown list with the addition of a variable that allowed me to check which line of the data it was triggered from. When I created the row for the datatable and thus the dropdown list I set this variable to the itemID value and created an event handler that handled the output from the dropdown list on each row of the data.
In the handler I then checked for this code to know which line triggered the event.
This isnât the exact code (is coming from memory)and thus may need some tweaking but basically in C#::
private class myDropDownList: DropDownList()
{
int dataRowID
â¦
}
and
private void my DropDownListHandler(object sender, System.EventArgs e)
{
myDropDownList ddl=object as myDropDownList;
itemID=ddl.dataRowID;
â¦
//rest of the handler code
}
let me know if this helps
|