Validus … talkin bout <code> n sh!t

25Nov/110

ASPxGridview – Specified method is not supported

I keep getting this error whenever I create a new ASPxGridView with RowUpdating/RowInserting/RowDeleting.

Basically my code behind looks like so:

// I setup my event handling from the code behind
myGridView.RowInserting += new DevExpress.Web.Data.ASPxDataInsertingEventHandler(myGridView_RowInserting);

// This is the actual event being handled
void myGridView_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) {

// All my logic here

myGridView.CancelEdit();
myGridView.DataBind();
}

Originally when I first create the Gridview and all the events I put a throw new NotImplementedExeption() to gracefully tell the end user that this area is unfinished. This way I can check all the rest of my code to ensure it works before proceeding with everything else.

So after all that initial checking is done I start adding the RowInserting methods and test it out... and get the annoying.

Specified method is not supported

It's rather ambiguous, but at the same time true. Basically I forgot to cancel the event from skipping through my code (I think would be a good term to use).

So, what's the solution? e.Cancel = true;, cannot believe I missed this sucker!

void myGridView_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) {

e.Cancel = true;

// All my logic here

myGridView.CancelEdit();
myGridView.DataBind();
}

At least now that I've blogged about it, I'll never forget it!

Related posts:

  1. ASPxGridView: How to remove command buttons on individual rows
  2. DevExpress.Web.ASPxGridView.ASPxGridViewBehaviorSettings.AllowMultiSelection is obsolete
  3. ASPxGridView – The target x for teh callback could not be found or did not implement ICallbackEventHandler
  4. The type or namespace name ‘DefaultBoolean’ does not exist in the namespace ‘DevExpress.Web.ASPxClasses’ (are you missing an assembly reference?)
  5. Example DataTable
Filed under: C# Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.