开发者

Can't un-select my DevExpress LookUpEdit

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开发者_如何学Go 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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜