Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Problem with Delete and Edit button in Datagrid - will not reach handler (http://www.velocityreviews.com/forums/t76524-problem-with-delete-and-edit-button-in-datagrid-will-not-reach-handler.html)

Alex 04-22-2004 08:09 PM

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)
{
////
}



Matt Berther 04-22-2004 09:31 PM

Re: Problem with Delete and Edit button in Datagrid - will not reach handler
 
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

Alex 04-22-2004 09:57 PM

Re: Problem with Delete and Edit button in Datagrid - will not reach handler
 
It turned out that I didn't have the IsPostBack check in the page laoder...

"Matt Berther" <mberther@hotmail.com> wrote in message
news:%239uNzELKEHA.556@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





All times are GMT. The time now is 12:36 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.