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
20
UltraGrid Column used as Dropdown - Display Text
posted

I am creating a custom datasource where I create a Data Table with 5 columns and pre-populate the data. One of the columns stores an ID value from another table (ContainerID) and I would like to have that column as a dropdown with the available Containers. I get this data table in another data pull and mostly everything works fine except on the initial viewing of the grid. See code below. 

As you can see below, the data initially has a value of 3. How can I get it to show the description instead, like in a normal combo?

I tried the bindingvaluelist and a regular valuelist, both had same results. 

rTable = GetContainerTable()
				

		ugvContainers.DataSource = rTable
		If ugvContainers.DisplayLayout.ValueLists.Contains("Containers") Then
			ugvContainers.DisplayLayout.ValueLists.Remove("Containers")
		End If

		Dim vList as Infragistics.Win.ValueList = ugvContainers.DisplayLayout.ValueLists.Add("Containers")
		Dim cTable as Erp.BO.ContainerHeaderListDataSet.ContainerHeaderListDataTable = GetContainerDataSet()

		For Each dr as DataRow in cTable.Rows
			vList.ValueListItems.Add(dr("ContainerID"), dr("ContainerDescription"))
		Next

		Dim bvl as Infragistics.Win.BindableValueList = New Infragistics.Win.BindableValueList()
		bvl.DataSource = cTable
		bvl.ValueMember = "ContainerID"
		bvl.DisplayMember = "ContainerDescription"
		bvl.BindingContextControl = ugvContainers

		ugvContainers.DisplayLayout.Bands(0).Columns("Cont").ValueList = bvl
		ugvContainers.DisplayLayout.Bands(0).Columns("Cont").Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList
		ugvContainers.DisplayLayout.Bands(0).Columns("Cont").Width = 200

Parents
  • 34430
    Offline posted

    Hello Mike,

    I have created a sample project based on the code that you have provided, and at the moment, I am unable to reproduce the behavior you are referring to, as the BindableValueList.DisplayMember is showing through in the UltraGrid's DropDownList column. I am not entirely sure as to why this is not working for you, but perhaps it is a difference in the Infragistics for Windows Forms versions we are using, or perhaps a misunderstanding of your requirement on my end?

    I have attached the sample project I used to test this. Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem.

    If the project does not work correctly, this indicates either a problem possibly specific to your environment, or a difference in the DLL versions we are using. My test was performed using version 17.2.20172.1000 in Infragistics for Windows Forms 2017.2.

    If the project does show the product feature working correctly, this indicates a possible problem in the code of your application. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.

    Or, if this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one.

    Please let me know if you have any other questions or concerns on this matter.

    6371.UltraGridDropDownDisplayVB.zip

    Sincerely,
    Andrew
    Associate Developer

Reply Children
No Data