Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
Assigning cell object values in UltraDropDown
posted

Hi, I'm having trouble assigning values of non-standard type (not integer, string, or whatever) to a cell with a UltraDropDown grid.

I'll try to explain

My grid (Let's call it Grid1)  is bound to a list of clsTypeA  "Grid1.DataSource =  New BindingList(of clsTypeA)" where:

public class clsTypeA

    public Id as Long

    public obj as clsTypeB

end class

Then I have an UltraDropDown (let's call it DropDown1) bound to a list of clsTypeB

public class clsTypeB

    public Id as Long

    public Description as string

    public overrides function ToString() as string

          return Me.Description

    end function

end class

In Grid1, the column "obj" ValueList property is set to DropDown1.

I enter the main grid Grid1 in edit mode, add a new row... go to the cell for the value of "obj", open the dropdown and the list of objects is there. Then I select any of the objects, but the grid, instead assigning the object I selected to the property "obj" in the row, it assigns the string of "Description", so when I try to update the row I get an error "Cannot convert string to clsTypeB".

Why is it assigning a string value when the DataSource for the UltraDropDown is of clsTypeB and the value type for the column is also clsTypeB and not string?? Do I have to change any special property? what would be the way to accomplish what I'm trying to do?

I've tried also to set the Style property of the column to "DropDownList" to avoid editing (that's another problem) but then even if I select an object in DropDown1, no value is assigned to the cell...

I don't know if I explained myself very wel...