Bounded columns type - MultiComboBoxColumn

2 posts, 0 answers
  1. Kuba
    Kuba avatar
    13 posts
    Member since:
    Aug 2013

    Posted 26 Nov 2013 Link to this post


    I have RadGridView bounded with DataSet. Is there any way to change type of the columns?

    For example I have DataTable in DataSet with columns: Id, Name and Job. I'm creating data binding between RadGridView
    and DataSet. I would like to have three columns in my RadGridView: Id (typeof DecimalColumn), Name (typeof TextBoxColumn), Job (typeof MultiComboBoxColumn). I know that I have to have Id as System.Int32, Name as System.String in  my DataSet, but how can I change Job into MultiComboBoxColumn?

    Thanks for help, Kuba
  2. Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    3945 posts

    Posted 29 Nov 2013 Link to this post

    Hello Kuba,

    Thank you for contacting Telerik Support.

    It is allowed to generate columns of data bound grid manually and specify their type. As to the GridViewMultiComboBoxColumn, it is necessary to set its DataSource property. Here is an example how to configure the described columns and populate the GridViewMultiComboBoxColumn:
    public Form1()
        DataSet dataSet = new DataSet();
        DataTable dataTable = new DataTable();
        for (int i = 0; i < 10; i++)
            dataTable.Rows.Add(i, "Name" + i, null);
        DataTable jobDataTable = new DataTable();
        for (int i = 0; i < 5; i++)
            jobDataTable.Rows.Add("Job" + i);
        radGridView1.AutoGenerateColumns = false;
        GridViewDecimalColumn decimalColumn = new GridViewDecimalColumn("Id");
        GridViewTextBoxColumn textBoxColumn = new GridViewTextBoxColumn("Name");
        GridViewMultiComboBoxColumn mccbColumn = new GridViewMultiComboBoxColumn("Job");
        mccbColumn.DataSource = dataSet.Tables[1];
        radGridView1.DataSource = dataSet.Tables[0];
        radGridView1.CellBeginEdit += radGridView1_CellBeginEdit;
    private void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
        GridViewEditManager editManager = sender as GridViewEditManager;
        if (editManager.GridViewElement.CurrentColumn is GridViewMultiComboBoxColumn)
            RadMultiColumnComboBoxElement editor = (RadMultiColumnComboBoxElement)this.radGridView1.ActiveEditor;
            editor.EditorControl.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;

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

    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top