ComboBoxColumn: Unique List per Row

2 posts, 0 answers
  1. Gone2TheDogs
    Gone2TheDogs avatar
    66 posts
    Member since:
    May 2016

    Posted 16 Jan 2017 Link to this post

    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()

     

     

     

     

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    4077 posts

    Posted 17 Jan 2017 Link to this post

    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.
Back to Top