I have an UltraGrid UltraCombo I'm using for a "Work Type" drop-down where user can select multiple Work Types. The datasource I'm connecting to will bring back all work types and also a column that identifies whether or not the column is selected, the value will be True/False for each row.
How do I list all of the work types and have a checkbox selected next to the work type that is "True"?
Dim ds As System.Data.DataSet ds = PTWFormDataAccess.LoadPTWWorkTypes(formid) Me.ddlWorkTypes.DataSource = ds.Tables(0)
Dim c As UltraGridColumn = Me.ddlWorkTypes.DisplayLayout.Bands(0).Columns.Add() c.Key = "Selected" c.Width = 40 c.Header.Caption = String.Empty c.Header.CheckBoxVisibility = HeaderCheckBoxVisibility.Always c.DataType = GetType(Boolean) c.Header.VisiblePosition = 0
Me.ddlWorkTypes.CheckedListSettings.CheckStateMember = "Selected" Me.ddlWorkTypes.CheckedListSettings.EditorValueSource = Infragistics.Win.EditorWithComboValueSource.CheckedItems Me.ddlWorkTypes.CheckedListSettings.ListSeparator = " - "
Me.ddlWorkTypes.CheckedListSettings.ItemCheckArea = Infragistics.Win.ItemCheckArea.Item Me.ddlWorkTypes.DisplayMember = "PTWWorkTypeName" Me.ddlWorkTypes.ValueMember = "PTWWorkTypeNamesId" Me.ddlWorkTypes.DropDownWidth = 350 Me.ddlWorkTypes.DisplayLayout.Bands(0).Columns("PTWWorkTypeName").Header.Caption = "Work Type"
The above code gets all work types from the work type table. I have a column called "chk_selected" that is either True or False. I want "Selected" to be checked if "chk_selected" is True.
Hi,
I'm having trouble understanding what you are asking. It sounds like you already have a boolean column in your data source, so why are you creating an additional unbound column? It sounds like you want both columns to contain the same value. So why have two columns? Why not just use "chk_selected" as your CheckStateMember directly?
Thank you for the reply. Yes I am doing that now.
I thought I needed to add a "Selected" column for the checkbox? This code creates the checkbox but I can't select/checkmark the checkboxes:
Sub LoadPermitWorkTypes() 'pass in PTWFormId Dim ds As System.Data.DataSet ds = PTWFormDataAccess.LoadPTWWorkTypes(Me.PTWFormId) Me.ddlWorkTypes.DataSource = ds.Tables(0)
Me.ddlWorkTypes.CheckedListSettings.CheckStateMember = "chkSelected" Me.ddlWorkTypes.CheckedListSettings.EditorValueSource = EditorWithComboValueSource.CheckedItems
Me.ddlWorkTypes.CheckedListSettings.ItemCheckArea = ItemCheckArea.Item Me.ddlWorkTypes.DisplayMember = "PTWWorkTypeName" Me.ddlWorkTypes.ValueMember = "PTWWorkTypeNamesId" Me.ddlWorkTypes.DropDownWidth = 350 Me.ddlWorkTypes.DisplayLayout.Bands(0).Columns("PTWWorkTypeName").Header.Caption = "Work Type" End Sub
This code gives me "chkSelected" as True and False values, but its not rendering a checkbox:
Sub LoadPermitWorkTypes() 'pass in PTWFormId Dim ds As System.Data.DataSet ds = PTWFormDataAccess.LoadPTWWorkTypes(Me.PTWFormId) 'Hide Suspended rows on Initialize Row event Me.ddlWorkTypes.DataSource = ds.Tables(0)