Rami Alshareef
Rami Alshareef

Reputation: 7160

Custom delete in ASP.NET Dynamic Data scaffolds

How could I implement a custom delete operation in a ASP.NET Dynamic Data Project? I found this post but nothing helped. Here's the block of code for the delete command:

enter image description here

If I implemented the GridView1_RowCommand event I can catch it on the debugger, but where does the actual Delete command code stored, and if I changed the commandName to newDelete how to implement a custom delete query?

Upvotes: 3

Views: 894

Answers (1)

Muhammad Akhtar
Muhammad Akhtar

Reputation: 52241

You can use RowCommand event to gridview and write custom code for deletion

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
    if (e.CommandName == "newDelete ")
    {
      e.CommandArgument // will Return current Row primary key value
        ..............
      //Write Delete custom code here
      .............
    }
}

Upvotes: 1

Related Questions