protected void Button1_Click(object sender, CommandEventArgs e) { if (e.CommandName == "Save") { // Perform save operation } else if (e.CommandName == "Delete") { // Perform delete operation } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { int rowIndex = Convert.ToInt32(e.CommandArgument); if (e.CommandName == "Edit") { // Perform edit operation on the row with the specified index } else if (e.CommandName == "Delete") { // Perform delete operation on the row with the specified index } }Package library: System.Web.dll (in the .NET Framework) or System.Web.Extensions.dll (in the ASP.NET AJAX Extensions).