I have a ultra combo box that has a datasource which is a collection of objects. The Valuemember is "ColorID" and the displaymember is "Name". When the form opens I always want the ultracombo to display the row with the "ColorID" of 26. What's the best way to accomplish this? I don't want to loop through all of the rows looking for the value member, i'd like to find the Infragistics equivalent of:
ColorsCombo.SelectedValue = 26
to put in my form load event.
Set the ultraCombo.Value = 26
Thanks. I'm not sure how I missed that... I guess I was stuck trying to mess with ActiveRow.
Because it needs to be consistent with all of the other editor controls - they all use Value.
When I have a UltraCombo in a UltraWinGrid cell, setting the .Value changes the display to that value instead of the text value in the dropdown.
For example, the dropdown text is "Default", the key value is 123, I set the .Value property to 123, and the dropdown displays cell didplays 123, instead of "Default"
Thanks
Hi James,
What exactly do you mean when you say "UltraCombo in a UltraWinGrid cell"? Are you assign an UltraCombo to the EditorControl property of hte cell or the ValueList of the cell?
Are you setting the Value property on the UltraCombo or on the grid cell?
Yes, to the EditorControl property. I’ve tried both to the cell value and the UltraCombo value, but no luck.
For example:
DirectCast(DirectCast(DirectCast(e.Row.Cells("somefield"), Infragistics.Win.UltraWinGrid.UltraGridCell).EditorControlResolved, System.Windows.Forms.Control), Infragistics.Win.UltraWinGrid.UltraCombo).Value = 123
Well.. there are a lot easier and more efficient ways to provide a dropdown in a cell that using UltraCombo as an EditorControl. You might want to check out this KB article:
HOWTO:What is the best way to place a DropDown list in a grid cell?
Having said that, using an UltraCombo should work. Assigning the Value of the cell is the correct way to do this. Perhaps it has something to do with the event you are using? Maybe you are assigning the Value before the EditorControl? Or maybe the data type of the Value doesn't match the data type of the items on the list.
Well, asuming that you want to initialize the value of a new row that the user is just about to add, AfterRowInsert seems like a reasonable event to use.
Thanks, I'll check out the link.
I'm setting the Value property in the AfterRowInsert event of the grid, what event would you recommend to use?