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

Discussion in 'ASP .Net' started by Alex, Apr 22, 2004.

  1. Alex

    Alex Guest

    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)
    {
    ////
    }
    Alex, Apr 22, 2004
    #1
    1. Advertising

  2. Alex

    Matt Berther Guest

    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
    Matt Berther, Apr 22, 2004
    #2
    1. Advertising

  3. Alex

    Alex Guest

    It turned out that I didn't have the IsPostBack check in the page laoder...

    "Matt Berther" <> wrote in message
    news:%...
    > 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, Apr 22, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Schultz
    Replies:
    3
    Views:
    536
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Feb 14, 2005
  2. =?Utf-8?B?a2Vu?=
    Replies:
    1
    Views:
    10,295
    Wiktor Zychla [C# MVP]
    Jan 23, 2006
  3. AMT2K5
    Replies:
    0
    Views:
    339
    AMT2K5
    Mar 6, 2007
  4. dilbert
    Replies:
    0
    Views:
    453
    dilbert
    Jan 28, 2008
  5. Frank Kurka
    Replies:
    8
    Views:
    282
Loading...

Share This Page