Problem with Delete and Edit button in Datagrid - will not reach handler

A

Alex

I have a datagrid with two additional columns (edit, delete).
However the edit and delete handlers in the code behind page are never
reached.
When I click on the delete or edit button the load page handler gets
executed nothing else.
What could I do wrong?

Here some code:

private void InitializeComponent()
{
this.DataGrid1.PageIndexChanged += new
System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.DataGrid1_Pag
eIndexChanged);
this.DataGrid1.EditCommand += new
System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_EditCom
mand);
this.DataGrid1.DeleteCommand += new
System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_Delete)
;
this.Load += new System.EventHandler(this.Page_Load);

}

protected void DataGrid1_EditCommand(Object sender, DataGridCommandEventArgs
e)
{
////
}
 
M

Matt Berther

Hello Alex,
I have a datagrid with two additional columns (edit, delete).
However the edit and delete handlers in the code behind page are never
reached.
When I click on the delete or edit button the load page handler gets
executed nothing else.

Make sure that you set the button's CommandName property to "Edit" or "Delete".

<asp:Button id="whatever" runat="server" CommandName="Edit">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top