ButtonColumn and EditCommandColumn don't work together as expected in DataGrid

Discussion in 'ASP .Net' started by Piotr, Jan 6, 2006.

  1. Piotr

    Piotr Guest

    Hi,

    I have a DataGrid with standard EditCommandColumn with PageIndex enabled.
    Everything works fine.
    When I add ButtonColumn

    <asp:ButtonColumn
    Text="Delete"
    HeaderText=""
    CommandName="Delete"/>

    and modify DataGrid with

    OnItemCommand="datagrid_Delete"

    strange things happen. It seems to work until I click one of "Edit" buttons.
    It changes properly to edit mode but then no matter what button I click next
    ("Cancel", "Update", some other "Edit" or one of page changing buttons) it
    always runs OnItemCommand, and what's very strange, CommandName property has
    always "Delete" value instead of "Cancel" , "Update" or whatever name of
    button I clicked:

    protected void datagrid_Delete(object o, DataGridCommandEventArgs e)
    {
    Response.Write("I clicked " + e.CommandName);
    ...
    }

    gives:

    I clicked Delete

    Strangly it works after another click...
    Why the h... is that?

    Thanks,
    Piotr
     
    Piotr, Jan 6, 2006
    #1
    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. jj
    Replies:
    5
    Views:
    3,567
    Hywel
    Apr 23, 2004
  2. Fabian Holler

    regex module, or don't work as expected

    Fabian Holler, Jul 4, 2006, in forum: Python
    Replies:
    3
    Views:
    303
    Fredrik Lundh
    Jul 4, 2006
  3. Blastbeat
    Replies:
    5
    Views:
    1,548
    Blastbeat
    Nov 9, 2005
  4. Piotr
    Replies:
    2
    Views:
    145
    Piotr
    Jan 9, 2006
  5. Piotr
    Replies:
    2
    Views:
    157
    Piotr
    Jan 9, 2006
Loading...

Share This Page