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:
- ASPxGridView: How to remove command buttons on individual rows
- DevExpress.Web.ASPxGridView.ASPxGridViewBehaviorSettings.AllowMultiSelection is obsolete
- ASPxGridView – The target x for teh callback could not be found or did not implement ICallbackEventHandler
- The type or namespace name ‘DefaultBoolean’ does not exist in the namespace ‘DevExpress.Web.ASPxClasses’ (are you missing an assembly reference?)
- Example DataTable
