C
Cappy
Hi guys.
I have a datagrind that is bound to a custom collection of a custom
object.
When a delete button is pressed in the datagrid, I not only want to
remove the row from the grid, I want to delete the object from the
collection that is bound to the grid.
So far I have this.
public void groupsGrid_DeleteCommand(object sender,
DataGridCommandEventArgs e)
{
try
{
//My Group object UMGroup grouptodelete =
(UMGroup)e.Item.DataItem;
// attempt delete
groupsCollection.Remove(grouptodelete);
}
catch(Exception exp)
{
Errortxt.Text = exp.Message;
}
//Disable Edit mode
groupsGrid.EditItemIndex = -1;
//Refresh data in grid
PopulateDatagrid();
}
My problem is, grouptodelete comesback with object undefined. Is there
away of getting access to the object that is supplying data to the row
that fired the delete command?
Thanks
Amit
I have a datagrind that is bound to a custom collection of a custom
object.
When a delete button is pressed in the datagrid, I not only want to
remove the row from the grid, I want to delete the object from the
collection that is bound to the grid.
So far I have this.
public void groupsGrid_DeleteCommand(object sender,
DataGridCommandEventArgs e)
{
try
{
//My Group object UMGroup grouptodelete =
(UMGroup)e.Item.DataItem;
// attempt delete
groupsCollection.Remove(grouptodelete);
}
catch(Exception exp)
{
Errortxt.Text = exp.Message;
}
//Disable Edit mode
groupsGrid.EditItemIndex = -1;
//Refresh data in grid
PopulateDatagrid();
}
My problem is, grouptodelete comesback with object undefined. Is there
away of getting access to the object that is supplying data to the row
that fired the delete command?
Thanks
Amit