Hi,
I have a hierarchical grid, which is bound to a dataset via the DataBind method.
On certain columns I have to display the text in stead of numbers.
I do this at the moment in creating valuelists for these columns by looping thru the rows of a datatable.
Somtimes I need the same valuelists in two columns but different bands or even in two grids on the same form.
To get this working I have to clone the valulists otherwise I get a runtime error.
I'm wondering if there is no way to bind a valuelist of acolumn directly to the dataset.
Yes You are wrong.
I create Valuelists in code and assign them to coulumns and the error appears and says that the appearance must be the same as used before.
That is nonsens.
If I just reassigns the programmatically established list to the local object before assigning it to a gird column the stupid error does not appear.
I 'm not quite sure what causes this behaviour, but reassigning the same valuelist to the same local object cures the problem.
The UltraDropDown might be a good solution. Also, what is the error you get when you try to use the same ValueList in different grids? I think there might be a problem if you create a ValueList in the grid's ValueLists collection and try to use it in another grid. But if you just declare a new ValueList object in code, I would think it would work with two different grids just fine. I could be wrong.
Have you tried the UltraDropDown control, it is like the UltraCombo but is for use with the columns of an UltraGrid?
That is a quite nice solution.
Havn't thought on doing it this way.
But anyway it would be much easier if You could bind it like on a combo box.
Many Thanks
I try to fiure it on my solution
i'v built this function with 4 overloads, you pass a dt it returns as valuelist
Return getLookupValueList(lkpdt, displayCol, isExpr, String.Empty, False)
Return getLookupValueList(lkpDT, displayCol, isExpr, filter, False)
Return getLookupValueList(lkpDT, displayCol, isExpr, String.Empty, sort)
End Function
'same as above, but it filters the datatable by the given filter value
If isExpr Then
displayCol = "expr"
End If
If filter = String.Empty Then
If sort = True Then
myRows = lkpDT.Select("TRUE=TRUE", displayCol)
Else
myRows = lkpDT.Select()
myRows = lkpDT.Select(filter, displayCol)
myRows = lkpDT.Select(filter)
myVL.Key = lkpDT.TableName
If Not row.RowState = DataRowState.Deleted Then myVL.ValueListItems.Add(row.Item(0), row.Item(displayCol).ToString)
Next
If myVL.ValueListItems.Count = 0 Then
myVL.ValueListItems.Add(0, "**No Items In List**")
lkpDT.Columns.Remove("expr")