Link to home
Start Free TrialLog in
Avatar of Michael_R_Evans
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 .....GridViewDeleteEventArgs RowIndex value.....?
Avatar of lijunguo
lijunguo
Flag of Australia image

Here is a good tutorial on GridView delete
http://www.codeproject.com/aspnet/GridViewConfirmDelete.asp
Avatar of Michael_R_Evans
Michael_R_Evans

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
Avatar of lijunguo
lijunguo
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
From GV set up DataKeyNames="column name", then following the first link I posted, you'll get there