Hello .. any help with this is appreciated. I am using 8.2. I added a valuelist to a column in the designer but it was displaying the value instead of the text, so I removed it and used the following code from a knowledge base article. Still it is displaying the number instead of the letter until I click on it to edit.
Dim vList As New Infragistics.WebUI.UltraWebGrid.ValueList()gridApps.Columns(4).ValueList = vListvList.ValueListItems.Add(0, " ")vList.ValueListItems.Add(1, "R")vList.ValueListItems.Add(2, "T")gridApps.DisplayLayout.Bands(0).Columns(4).ValueList = vListgridApps.DisplayLayout.Bands(0).Columns(4).ValueList.DisplayStyle = Infragistics.WebUI.UltraWebGrid. ValueListDisplayStyle.DisplayText
Hello,
This code should work. I was wondering about the data type of the column. What kind of data is displayed in the column? When the cell goes into edit mode, then the text field of the ValueList is displayed in the dropdown. When one of the option from the dropdown is selected it overwrites the text presented in the cell. The AllowUpdate property for this column needs to be set to true in order to do this. Please include these following lines of code after populating the ValueList:
UltraWebGrid1.Columns(4).AllowUpdate = Infragistics.WebUI.UltraWebGrid.AllowUpdate.Yes
UltraWebGrid1.Columns(4).Type = Infragistics.WebUI.UltraWebGrid.ColumnType.DropDownList
UltraWebGrid1.Columns(4).ValueList = vList
Let me know if you get any issues with this.
Thanks
I put in the suggested lines, and I am still not getting the display text showing until you enter edit mode. Then you can see the text displayed in the dropdown. And the updates do work correctly. I have attached a sample project, I put the script to create the simple table I used in the web.config. I tried putting the code in various places, and now just have it in the pageload.
Hi Folks,
Do you know if the ValueList feature is still available on the new version of WebDataGrid and WebHierarchicalDataGrid Controls (11.2.20112.2025)?
If not, what functionality has replaced it? Or how should a similar solution be implemented?
Thanks,
Victor
For future readers, the value display was not working because the grid thought the column type was String, bu that the Id type of the ValueList was integer...Making both types the same (Integer in this case) fixed up the issue.
That works pretty good .. thanks, I'm going to do that. I still think the other should work.
Hi,
I am joining this thread too late. But following is my approach which I generally use when I want to bind value list for any column.
I just populate a DataTable from my primary table of my value list reference column. Later I bind that table with value list of the column and set DisplayMember and ValueMember properties.
This is very simple and logical because we always need reference value from some primary data base table.
I have tested the sample with following code. The in actual program dt should be filled from primary table from database.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim dt As DataTable
dt = New DataTable()
dt.Columns.Add("Byte", GetType(Byte))
dt.Columns.Add("Txt", GetType(String))
Dim dr As DataRow
dr = dt.NewRow()
dr(0) = 4
dr(1) = " "
dt.Rows.Add(dr)
dr(0) = 1
dr(1) = "A"
'Similarly add rows for B,C,D....
'dt should be filled with data from primary table
grid1.Columns(2).AllowUpdate = Infragistics.WebUI.UltraWebGrid.AllowUpdate.Yes
grid1.Columns(2).Type = Infragistics.WebUI.UltraWebGrid.ColumnType.DropDownList
grid1.Columns(2).ValueList.DataSource = dt
grid1.Columns(2).ValueList.DisplayMember = "Txt"
grid1.Columns(2).ValueList.ValueMember = "Byte"
grid1.Columns(2).ValueList.DataBind()
End Sub
I'm wondering why the InitializeRow event is getting fired twice? I didn't get a chance to look at the second sample you've attached here. However, to work around the issue you are having with comparing the cell values, you can include a hidden column where the values (0,1,2 etc) are stored and depending on these values you can populate the visible column with text ('R','T' etc). The ValueList should be embedded to the visible column.
I'll give you my feedback on the code as soon as I get a chance.