Infragistics UltraWinGrid 删除确认

发布于 2024-07-29 18:43:57 字数 176 浏览 14 评论 0原文

默认情况下,ultraWinGrid 对于任何行删除都会弹出一个删除确认框。 我如何关闭该功能?

如果我在代码中删除,那没问题:

myUltraGrid.DeleteSelectedRows(False)

但我不知道当用户按下删除键时如何应用它。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

痴情换悲伤 2024-08-05 18:43:57

您可以检测到他们何时按下您所在行上的删除键。 使用类似 BeforeRowsDeleted 事件的东西。 该事件公开 BeforeRowsDeletedEventArgs 对象,该对象具有可供您使用的 e.DisplayPromptMsg 属性。

private void ultraGrid_BeforeRowsDeleted(object sender, BeforeRowsDeletedEventArgs e)
{
     e.DisplayPromptMsg = false;
}

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;
}
静待花开 2024-08-05 18:43:57

如何避免堆栈溢出/无限循环? – 杰夫 6 秒前

auujay 拿到了。 它不会导致无限循环,因为无论选择和删除多少行,它都只运行一次。 这一切所做的就是关闭通用消息框。 我们使用它来显示预删除的自定义消息,例如“您真的、真的确定吗?”

如果没有,请使用e.cancel=true

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.

放我走吧 2024-08-05 18:43:57

根据 文档

UltraGridRow.Delete(false);

According to the documentation

UltraGridRow.Delete(false);
久伴你 2024-08-05 18:43:57

有一个更好的办法:

grid.DisplayLayout.Override.AllowDelete = DefaultableBoolean.False;

There is a better way:

grid.DisplayLayout.Override.AllowDelete = DefaultableBoolean.False;
我家小可爱 2024-08-05 18:43:57

最好的解决方案是使用

UltraGridRow.Delete(displayPrompt As Boolean)

所以

如果您想要消息:
UltraGridRow.Delete(True)

如果您不想要该消息:
UltraGridRow.Delete(False)

The best solution is to use

UltraGridRow.Delete(displayPrompt As Boolean)

so

if you want the message :
UltraGridRow.Delete(True)

if you dont want the message :
UltraGridRow.Delete(False)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文