简体   繁体   English

如果gridview的行验证失败,如何丢弃行(devexpress)

[英]How to discard row if gridview's row validation fails (devexpress)

In XtraGridView, from the way RowValidation works, it seems that user has no choice but first correct the values (leading to validation being successful) and then press Discard button (which I provided separately and it does RejectChanges). 在XtraGridView中,从RowValidation的工作方式来看,用户似乎别无选择,只能先更正值(导致验证成功),然后按Discard按钮(我单独提供了该按钮,并且它执行RejectChanges)。 I want an option that user can discard the row without any pop-up alert even if row has invalid data. 我想要一个选项,即使行包含无效数据,用户也可以丢弃该行而没有任何弹出警报。

In my case when user presses Discard, it leads to row validation being fired (due to focus change). 在我的情况下,当用户按下“放弃”时,会导致行验证被触发(由于焦点更改)。 The discard button event handler is suppressed, if row validation is unsuccessful. 如果行验证不成功,则丢弃按钮事件处理程序将被抑制。 This way I am never able to simply discard the invalid row. 这样,我永远无法简单地丢弃无效的行。

This is common feature anyone with a grid would need. 这是具有网格的任何人都需要的常见功能。 Expecting a standard solution or a workaround. 期望使用标准解决方案或解决方法。

You made me curious, as you say,something as basic as that should be in there somewhere. 就像你说的那样,你让我感到好奇,那是应该存在的基本东西。

Bit of gooling found that waht you do is trap the InvalidRowException, it has a var argument and you can set it to ignore. 一点点咕咕声发现您要做的是捕获InvalidRowException,它具有var参数,您可以将其设置为忽略。

Here's where I found it. 这是我找到的地方。

DevExpress 开发快递

Can't you check the focused button and sidestep validation if the discard button is focused. 如果舍弃按钮为焦点,则无法检查焦点按钮和回避验证。

The general DevExpress setup forces the user to insert valid values when validating, pressing Esc is a simple solution to reset the field to the original value. 一般的DevExpress设置会强制用户在验证时插入有效值,按Esc是将字段重置为原始值的简单解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM