468,510 Members | 1,769 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,510 developers. It's quick & easy.

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

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.DataGridPageChangedEvent Handler(this.DataGrid1_Pag
eIndexChanged);
this.DataGrid1.EditCommand += new
System.Web.UI.WebControls.DataGridCommandEventHand ler(this.DataGrid1_EditCom
mand);
this.DataGrid1.DeleteCommand += new
System.Web.UI.WebControls.DataGridCommandEventHand ler(this.DataGrid1_Delete)
;
this.Load += new System.EventHandler(this.Page_Load);

}

protected void DataGrid1_EditCommand(Object sender, DataGridCommandEventArgs
e)
{
////
}
Nov 18 '05 #1
2 1372
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">

--
Matt Berther
http://www.mattberther.com
Nov 18 '05 #2
It turned out that I didn't have the IsPostBack check in the page laoder...

"Matt Berther" <mb******@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
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">

--
Matt Berther
http://www.mattberther.com

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by vinayak | last post: by
reply views Thread by Curtis Hatter | last post: by
4 posts views Thread by Jeff User | last post: by
4 posts views Thread by drakuu | last post: by
2 posts views Thread by Rajani | last post: by
9 posts views Thread by rn5a | last post: by
11 posts views Thread by Ed Dror | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.