Can someone explain to me what's going on here...
I'm populating a grid based on a value selected in a stand alone UltraCombo. When opening the form I would like to initialize the combo with the most common selection and thus populate the grid with data.
Performing SetInitialValue automatically calls the ValueChanged event - which is great.
If I designate my ultracombo to be of style "DropDown" the following code runs fine - meaning that, in the ValueChanged event, the value has a valid value. However, if I simply change the style to "DropDownList" the ucChooseVendor.Value is null.
I had initially setup a bunch of forms with the style being DropDown (the default) but realized that the user could type text within the dropdown which I did not want - so I changed them to DropDownList style.
PS #1: Is there a way to have a DropDown style and yet prevent them from changing the list items (i.e., typeing) in the control?
PS #2: I also noticed that with the DropDown style, when I type bogus info into the combo the ucChooseVendor.Value is the value of the bogus data rather than say maybe null or -1. In other words, why now all of a sudden, does the control want to return the DisplayMember vs the ValueMember?
All-in-all, somewhat confusing behavior in my opionion.
Thanks,
Mark
private void form1_Load(object sender, EventArgs e)
{
.....other code here....
}
e)
....
DataTable dt = DataLayer.Vendors.GetGLAccountVendorItems(ucChooseVendor.Value.ToString()); // <= Value is Null here depending on style
)
Ok...do the following screen shots help.
Immediately after stepping over (Shift+F8) the following line, it jumps to the highlighted (yellow) line.
ucChooseVendor.Value = dummy;
>>then something is wrong and we will need a sample demonstrating this so we can look into it.
Well, early on in this post, Brian indicated having his own scenario that demostrated that there is an issue when he said:
"I stepped through our code in this scenario and this appears to be a bug. You should report it so that you receive a notification when the fix becomes available."
Beyond this, not sure what more I can do on my part to demostrate the issue.
If the list is already populated, then you should not be using SetInitialValue, you should just be setting the Value on the control.
SetInitialValue is specifically designed to allow you to set a value before the list is populated.
If setting the Value gives you the same bad results, then something is wrong and we will need a sample demonstrating this so we can look into it.
Forgot to point out that in both screen shots you can see that the underlying rowcount is 8 - thus verifying that the control is populated.
>>So my guess is that you are calling the method before you have populated the list and so the Value of the control is getting set to null because the Value you are trying to apply is not on the list
That's not the case...here are two screen shots in debug mode (I hope you can see them). The first is when it is set to DropDownList and the value is NULL. The second is after I simply went to the GUI and changed it to DropDown style - the value has the correct GUID value.
In each instance, the ValueChange event is not called until I SetInitialValue - confirmed with the breakpoint setting.
>>One way would be to populate the list first and then simply set the Value property on the control (you don't need to call SetInitialValue in that case).
And thus, the whole reason why I am attempting to use SetInitialValue in the first place. Setting the value displays a Guid (the actual value) rather than the friendly text (DisplayMember).
One hack that I tried was to simply set the DropDownStyle in code after SetInitialValue as such:
ucChooseVendor.DropDownStyle = Infragistics.Win.UltraWinGrid.
UltraComboStyle.DropDownList;
Even though the dropdown intially displays the correct friendly value on startup the combo value is null when inspected in a button click.
It's not that I won't be able to find a work-around - my point of the post is that if I set the initial value to something valid I should subsequently be able to retrieve that value using ucChooseVendor.Value - regardless of a simple dropdown style settings.
Thank you Mike...
mnewmister said:Looked all over the site for where to do this...link please.
Submit an incident to Infragistics Developer Support