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

P

Piotr

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
 

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,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top