When user clicks on a grid header and presses the Delete key, I need to intercept that key press:
* If (selected) row is one that should not be deleted, terminate processing the delete key.
* else allow built-in Infragistics grid row delete processing to handle deleting the row.
Being new to Infragistics, I'm not sure:
1) how to set-up intercepting the Delete key press. I tried select the grid in VisualStudio in the designer and entered the name of a KeyUp handing routine, but it isn't invoked. Do I need to select something else? I tried entering names for KeyDown and KeyPress, but now I'm getting the error regarding 'MdiChildFormBase_Fill_Panel' - see below.
2) How do I: * Terminate Delete processing? * Allow Infratistics built-in processing to actually delete the row?
ALSO, how do I prevent the VS error "The variable 'MdiChildFormBase_Fill_Panel' is either undeclared or was never assigned. ". I get this fairly frequently. The designer generated 'MdiChildFormBase_Fill_Panel'. When VS complains about this, it no longer displays the design view. I'm using VS 2012 and Infragistics 2010.3. I know there's a 2012.1 version, but my department is using 2010.
Thanks,
Daryl
Daryl,
It would help to see the code for the form to get a better idea of what might have caused the warning and what is the best way to address it.
Hi Alan,
Thanks for the helpful tip. Sounds like just what I was looking for.
Got a helpful tip for my "The variable 'MdiChildFormBase_Fill_Panel' is either undeclared or was never assigned. " issue :-) ? After restarting VS2010, there are no designer errors, but (perhaps?) after running my application in debug and then stopping execution, something in VS2010 gets confused?
Rather than handling the key events of the grid it would be simpler to handle the BeforeRowsDeleted event and cancel it if the rows being deleted are not able to be deleted. The event exposes the Rows that will be deleted in the event args so that you can check if the row(s) are ones that can be deleted.
Let me know if you have any questions with this matter.
Restarting VS2010 resolved my designer error. I added handlers for both KeyDown & KeyPress. When I run the application the KeyDown handler does get invoked.
In my handler so far I just have local copies of the arguments so I can see what's available for determining if selected row is one that can be deleted or not. WhenI let execution continue, it did invoke the Infragistics Delete handler - the "do you want to delete this row" popup dialog displayed briefly displayed, then disappeared without getting a button click from me, and application became unresponsive. The VS debugger isn't waiting on input from me.