I have a multi column ultracombo control, I am trying to get the value of one of the columns and set it to my business object.
Lets say:
Shirt Size, Shirt Color
------------------------------
Small, White
Medium, Brown
Large, Black
The list is databound and the dropdown is bound to an object. Currently, I have ShirtSize databound to my business object property. Now, I need to set the ShirtColor as well to another property.
I use the ValueChanged event to set one of the cell values, but the problem is, as soon as I set to my business object property, the dropdown starts misbehaving. For example, when I select an item, the item gets focus for a second and then gets unselected.
My code looks like this:
Dim combo As Infragistics.Win.UltraWinGrid.UltraCombo = CType(sender, Infragistics.Win.UltraWinGrid.UltraCombo)
If (combo.SelectedRow IsNot Nothing) Then
Dim size As String = CStr(combo.SelectedRow.Cells("Size").Value)
mRequestItem.ProductSize = size
End If
There is a property changed event being raised when setting the product size.
Should I be using a different event? or how should I be handling this scenario?. As soon as I remove the productsize property set, then everything works ok (but of course, the value I need to set doesn't get set).
If the combo is bound, you have to add the row to the data source.
Hi Mike,
how to insert a Row in UltraCombo i have already bind dataset
ulcombo.DataSource = dscoram;
ulcombo.DataBind();
now i want to add extra row like value is "***********"
how can i add like wise in .net Dropdown we have option like
ddl.item.insert(0,listitem("*****"));
how can i achieve in ultracombo pls advice
Hm, this is pretty confusing to discuss in a forum thread.One odd thing I notice is that you are binding the Text property of the UltraCombo. That's a little unusual. You would probably be better off using the Value instead.
Perhaps you could post a small sample project demonstrating the problem?
>> I'm still a little unclear on what you are binding in terms of the editor portion of the control.
I assume you are binding the Value property of the UltraComboEditor. Are you binding it to an instance of a class? Or a property on your class? <<
And I am not clear on what you mean by binding to an instance of a class or a property of a class :)
I believe it is the property of the class.
Here is relevant code from the designer. Let me know if you want additional code.
It is a little different from the example I described...but "Dimension" is bound to a ProductDimension (string) property on the business object. The business object has its own datasource called RequestItemBindingSource.
The business object has a "ProductSize" (string) property, which I am trying to set when the dropdown is clicked using the ValueChanged event.
Dim UltraGridBand1 As Infragistics.Win.UltraWinGrid.UltraGridBand = New Infragistics.Win.UltraWinGrid.UltraGridBand("ProductSizeInfo", -1)
Dim UltraGridColumn1 As Infragistics.Win.UltraWinGrid.UltraGridColumn = New Infragistics.Win.UltraWinGrid.UltraGridColumn("Id")
Dim UltraGridColumn2 As Infragistics.Win.UltraWinGrid.UltraGridColumn = New Infragistics.Win.UltraWinGrid.UltraGridColumn("Size")
Dim UltraGridColumn3 As Infragistics.Win.UltraWinGrid.UltraGridColumn = New Infragistics.Win.UltraWinGrid.UltraGridColumn("Dimension")
....
'
'SizeUltraCombo
Me.SizeUltraCombo.CheckedListSettings.CheckStateMember = ""
Me.SizeUltraCombo.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.RequestItemBindingSource, "ProductDimension", True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged))
Me.SizeUltraCombo.DataSource = Me.ProductSizeBindingSource
.....
Me.SizeUltraCombo.Name = "SizeUltraCombo"
Me.SizeUltraCombo.Size = New System.Drawing.Size(121, 22)
Me.SizeUltraCombo.TabIndex = 23
Me.SizeUltraCombo.ValueMember = "Dimension"
I'm still a little unclear on what you are binding in terms of the editor portion of the control.
I assume you are binding the Value property of the UltraComboEditor. Are you binding it to an instance of a class? Or a property on your class?
If you are binding it to a single property on the class, then this seems like it should work okay. But if you are binding to the class instance itself, then I could see how this might cause a problem, because when you select an item from the list, that item on the list would be assigned to the Value of the UltraComboEditor. In which case, setting the ShirtSize on it would be redundant - since it would already be an instance of the class that has the same property settings. And when if it sends notifications, the combo might be re-selecting the item on the list that matches it and thus causing a recursive loop.