Search code examples
c#asp.netoracle-databasegridviewsqldatasource

Deleting Row Method on GridView


I am trying to implement the deleting method and pass my parameters for the delete operation. I am using sqldatasource. Since the ID doesnt have a column in my gridview how can I get the value of the ID and set it as my delete parameter?


Solution

  • ID doesn't need a column in the GridView, as long as it is in the datasource. Here's a simple GridView tutorial explaining the procedure...

    http://www.aspdotnetcodes.com/GridView_Insert_Edit_Update_Delete.aspx

    Their RowDeleting handler...

    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
      customer.Delete(GridView1.DataKeys[e.RowIndex].Values[0].ToString());
      FillCustomerInGrid();
    }