Tuesday, January 3, 2012

ASPxGridview Error: LinqDataSource '' does not support the Update operation unless EnableUpdate is true

When using ASPxGridview binded to a LinqServerModeDataSource, make sure that EnableUpdate is set to false when you are handling the update in the rowupdating event. I was getting the error

LinqDataSource '' does not support the Update operation unless EnableUpdate is true

because I forgot to add the following lines in the rowupdating event, which tells the grid that the event has been handled. Omitting these 2 lines causes the code to think that the update needs to be handled by the linqdatasource, which results in the above error

void MyGrid_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
{
   //Code to update, example:
   //int pb_pk; int.TryParse(Convert.ToString(e.Keys[0]), out pb_pk);
   //int pb_w3_Budget_fk; int.TryParse(Convert.ToString(e.NewValues["pb_w3_Budget_fk"]), out pb_w3_Budget_fk);
   //SqlDataProvider.PurchasingBudgets_Update(pb_pk, pb_w3_Budget_fk);
   e.Cancel = true;
   (sender as ASPxGridView).CancelEdit();
}


1 comment:

  1. The King Casino and Resort
    The king casino and resort features a modern casino with everything ventureberg.com/ you'd expect from a classic 바카라 사이트 Vegas Strip casino. The bsjeon.net resort features 50000 square feet of Funding: $250 millionDesign: https://jancasino.com/review/merit-casino/ Inspired DesignMasters: Ivan Karaszko หาเงินออนไลน์

    ReplyDelete