e.CommandName Always = "Edit"

S

Scot

I have dropped a DataGrid (.NET Framework 1.1) on a page, and using the VS
DataGrid Property Wizard, have added a button column with Edit, Update,
Cancel.

The grid displays correctly and when I click the Edit button, I get the
expected result of the Edit Command being triggered. My problem is that
once I change a value and click the Update button, the EditCommand is being
triggered, not the UpdateCommand.

Does anyone have any ideas about what I might have done wrong / forgotten to
set up.

Thanks in advance, code to follow.
Scot

private void InitializeComponent()

{

this.DataGridItemGrid.CancelCommand += new
System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGridItemGrid_
CancelCommand);

this.DataGridItemGrid.EditCommand += new
System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGridItemGrid_
EditCommand);

this.DataGridItemGrid.UpdateCommand += new
System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGridItemGrid_
UpdateCommand);

this.Load += new System.EventHandler(this.Page_Load);

}



private void DataGridItemGrid_EditCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)

{

DataGridItemGrid.EditItemIndex = e.Item.ItemIndex;

BindData();

}



private void DataGridItemGrid_UpdateCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)

{

PriceUpdater.StoreUpdater su = new PetShop.Web.PriceUpdater.StoreUpdater();

bool updateValid = su.UpdatePrices(ds);

}
 
E

Elton Wang

One reason to cause the problem might be disabled datagrid's viewstate.

HTH

Elton Wang
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top