Michael_R_Evans
asked on
ObjectDataSource Delete Command Parameters
I have a gridview thats datasource is an objectdatasource which has the following methods.
Select : return a DataSet //used to popluate from a sqlTable
public static DataSet SelectDataset()
{
//code to select DataSet
}
Delete : Method with 1 parameter used to Identify the id
public static void DeleteCommand(String id)
{
//code to delete
}
When the user clicks the Delete button the OnRowDeleting Event runs ...
Currently this errors out because the id value is never set before the DeleteCommand runs.
How do I ....set the String id parameter.... to the value from the .....GridViewDeleteEventAr gs RowIndex value.....?
Select : return a DataSet //used to popluate from a sqlTable
public static DataSet SelectDataset()
{
//code to select DataSet
}
Delete : Method with 1 parameter used to Identify the id
public static void DeleteCommand(String id)
{
//code to delete
}
When the user clicks the Delete button the OnRowDeleting Event runs ...
Currently this errors out because the id value is never set before the DeleteCommand runs.
How do I ....set the String id parameter.... to the value from the .....GridViewDeleteEventAr
ASKER
What I am looking for is a way ( if possible ) to set the parameters that are being used in the DeleteMethod that I created. Or if someone could explain to me how the GridView uses the ObjectDataSource to configure the parameters from the Method.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
From GV set up DataKeyNames="column name", then following the first link I posted, you'll get there
http://www.codeproject.com/aspnet/GridViewConfirmDelete.asp