Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Infragistics UltraWinGrid Delete Confirmation

By default the ultraWinGrid pops up a delete confirmation box for any row deletions. How do I turn that feature off?

If I'm deleting in the code, it's no problem:

myUltraGrid.DeleteSelectedRows(False)

But I don't know how to apply that when the user presses the delete key.

like image 399
Jeff Avatar asked Jul 29 '09 18:07

Jeff


2 Answers

You can detect when they press the delete key on your row. Use something like the BeforeRowsDeleted event. That event exposes the BeforeRowsDeletedEventArgs object which has the e.DisplayPromptMsg property available to you.

private void ultraGrid_BeforeRowsDeleted(object sender, BeforeRowsDeletedEventArgs e)
{
     e.DisplayPromptMsg = false;
}
like image 111
auujay Avatar answered Nov 14 '22 13:11

auujay


How do you avoid a stack-overflow/endless loop? – Jeff 6 secs ago

auujay has it. It will not cause an endless loop because it only runs once no matter how many rows are selected and deleted. All this does is turn off the generic message box. We use it so we can display custom messages pre-delete like "Are you really, really sure?"

Use e.cancel=true if no.

like image 42
Brian Spencer Avatar answered Nov 14 '22 12:11

Brian Spencer