This is a migrated thread and some comments may be shown as answers.

ComboBoxColumn: Unique List per Row

1 Answer 100 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Gone2TheDogs
Top achievements
Rank 1
Iron
Veteran
Gone2TheDogs asked on 16 Jan 2017, 09:03 PM

I have a grid with a ComboBoxColumn where each row will have a unique list. It is updated when the user clicks on a button.

As an example, Lets say each row represents a person and one of the columns is ComboBoxColumn has a header called, "Dept Worked". There is a static list of departments, but each person only has a subset of these departments.

Department List:  AP, AR, SA, IT, PU, MK, TR

Sally: aDept() =  {AP, AR, PU}

Nick:  aDept() = {SA, IT}

Julie:  aDept() = {MK, TR, SA}

 

I looked at the Telerik documentation on the ComboBoxColumn, but it only shows how to display a single list for all rows.

I also looked at the Cascading ComboBoxColumn How-To. It looked closer, but not sure because my event to populate the grid is under the Button event.

 

My columns were defined in VS visual editor, but I built code to dynamically fill an array for each combobox in the Dept column.

 

01.Private Sub btnApply_Click(sender As System.Object, e As System.EventArgs) Handles btnApply.Click
02. 
03.' data pulled from source here and placed in an array'
04. 
05. 
06.                    For x As Integer = 0 To aUserId.Length - 1
07.                        Dim rowInfo As GridViewRowInfo = MyGrid.Rows.AddNew()
08. 
09.                        Try
10.                             'Loading row data
11. 
12.                             'Column 1 : Combobox "Dept" - Each row will have a list of its own departments - aDept()

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 17 Jan 2017, 02:12 PM
Hello Bob,

Thank you for writing.  

The Cascading ComboBoxes in RadGridView KB article demonstrates the correct approach for handling this case. Note that it is important that the GridViewComboBoxColumn must have as a DataSource the full list of all available departments. As to the rows, in the CellEditorInitialized event, you must set the RadDropDownListEditorElement.DataSource property to the relevant subset of departments. You can download a sample project at the bottom of the following article: http://www.telerik.com/support/kb/winforms/gridview/details/cascading-comboboxes-in-radgridview 

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
Gone2TheDogs
Top achievements
Rank 1
Iron
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or