无法取消选择我的 DevExpress LookUpEdit

发布于 2024-09-29 19:09:24 字数 1086 浏览 2 评论 0原文

我有一个 DevExpress LookUpEdit,正在 VB.Net 中的 Visual Studio 2008 中使用。

我将 LookUpEdit 绑定到我的数据源,它显示的值可能为空或数据源中的行之一。我的程序显示一个树列表,当选择一个节点时,LookUpEdit 应该显示分配的值(可能为空)并让用户重新分配该值。 我确实将 LookUpEdit.Properties.AllowNullInput 设置为 True。 现在,当程序首次启动时,如果我选择的树列表中的第一个节点具有空值,如果我更改该值,LookUpEdit 将不显示任何内容LookUpEdit 的值在数据库中发生变化,如果我更改为具有 LookUpEdit 值的节点,该值会显示。

问题是,如果我从一个有值的节点切换到没有 LookUpEdit 的节点,则会显示前一个值。我已经通过了调试器,它仍然可以正确地进行获取。

我尝试重置 LookUpEdit.Text、LookUpEdit.EditValue 和 LookUpEdit.SelectedText,但没有任何效果。我什至复制了 LookUpEdit 第一次不显示任何内容时的条件(LookUpEdit.Text = "" 和 LookUpEdit.EditValue = " "),但它仍然显示最后一个值。

我正在设置实际值 lueLocation.EditValue = lueLocation.Properties.GetKeyValueByDisplayText(valueName)

编辑

所以我缩小了范围。在我将 Text 和 EditValue 设置为空之后,

lueLocation.Text = Nothing
lueLocation.EditValue = Nothing

值就被设置了。问题是在设置值的过程中会打开下拉菜单。所以我用lueLocation.ClosePopup()来关闭它。由于某种原因,当它被调用时,它会将 .Text.EditValue 更改回以前的值,从而调用 TextChanged Event

不知道为什么,但我无法保持下拉菜单打开。

I have a DevExpress LookUpEdit that I am using withing Visual Studio 2008 in VB.Net.

I have the LookUpEdit bound to my datasource and the value that it is displaying may be null or one of the rows in the datasource. My program displays a treelist and when a node is select the LookUpEdit is supposed to display the assigned value (could be null) and let the user reassign the value. I do have the LookUpEdit.Properties.AllowNullInput set to True. Right now when the program first starts if the first node in the treelist I choose has a null value the LookUpEdit displays nothing, if I change the value of the LookUpEdit the value changes in the database, if I change to a node that has a value for the LookUpEdit the value does display.

The problem is that if I switch from a node with a value to one without the LookUpEdit displays the previous value. I have gone through the debugger and it is still going through the fetch properly.

I have tried to reset the LookUpEdit.Text, LookUpEdit.EditValue and LookUpEdit.SelectedText but nothing works. I even replicated the conditions that the LookUpEdit has when it first displays nothing (LookUpEdit.Text = "" and LookUpEdit.EditValue = " ") but it still displays the last value.

I am setting the actual value with lueLocation.EditValue = lueLocation.Properties.GetKeyValueByDisplayText(valueName)

EDIT

So I narrowed it down. After I set the Text and EditValue to nothing

lueLocation.Text = Nothing
lueLocation.EditValue = Nothing

The values are set. The problem is that in the act of setting the value the dropdown menu opens. So I get it to close with lueLocation.ClosePopup(). For some reason when it gets called it changes the .Text and .EditValue back to the previous values and thus calls the TextChanged Event.

No clue why but I can't keep the dropdown menu open.

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

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

发布评论

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

评论(2

回忆那么伤 2024-10-06 19:09:24

通常,在 UI 中,Ctrl-Del 组合键应将其清除并将其设置为空。否则,在代码中,您应该能够设置 EditValue = Nothing 就可以了。

以下是 DX 网站上的几个链接:

搜索:http://search.devexpress.com/?q=clear+lookupedit&p=T4%7cP1%7c4&d=447

http://www.devexpress.com/Support/Center/p/Q96464.aspx
http://www.devexpress.com/Support/Center/p/Q270901.aspx

Generally in the UI the key combination of Ctrl-Del should clear it and set it to nothing. Otherwise in code, you should be able to set the EditValue = Nothing and that should do it.

Here are a couple of links on the DX site:

Search: http://search.devexpress.com/?q=clear+lookupedit&p=T4%7cP1%7c4&d=447

http://www.devexpress.com/Support/Center/p/Q96464.aspx
http://www.devexpress.com/Support/Center/p/Q270901.aspx

自由范儿 2024-10-06 19:09:24

我解决了这个问题。正如您在编辑中看到的,实际上是 lueLocation.ClosePopup() 导致它恢复到之前的 .Text.EditValue > 价值观。我删除了 lueLocation.ClosePopup() ,这导致我的界面在值为 null 时下拉菜单保持打开状态,如果存在实际分配的值则下拉菜单关闭。

我发现如果我将 .EditValue 设置为 DBNull.Value (lueLocation.EditValue = DBNull.Value) 而不是 Nothing< /code>、""" " 它将分配给 LookUpEdit 的值设置为空,并自动关闭下拉菜单。

I solved the problem. As you can see in the Edit it was the lueLocation.ClosePopup() that actually caused it to revert back to the previous .Text and .EditValue values. I removed the lueLocation.ClosePopup() which then caused my interface to have the dropdowns remain open if the value was null and closed if there was an actual assigned value.

I found that if I set the .EditValue to DBNull.Value (lueLocation.EditValue = DBNull.Value) rather than Nothing, "", or " " it set the value assigned to the LookUpEdit to nothing and automatically closed the dropdown menu.

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