How dataBind MultiColumnComboBox from collection and set autogenerate column false?

2 posts, 0 answers
  1. mudzakkir
    mudzakkir avatar
    7 posts
    Member since:
    Oct 2014

    Posted 24 Mar 2015 Link to this post

    Hi this is my code to bind the MultiColumnComboBox 
    http://pastebin.com/G1gsHk8G

    I want column displayed at grid is just 

    AccountNo, BankName, AccountName
    and the selected value is : BankAccountId

    Thank You in advance
    Regards
    1.             oRadGridView.Columns.Add(new GridViewTextBoxColumn("AccountNo"));
    2.             oRadGridView.Columns.Add(new GridViewTextBoxColumn("BankName"));
    3.             oRadGridView.Columns.Add(new GridViewTextBoxColumn("AccountName"));
    1.             oRadGridView.Columns.Add(new GridViewTextBoxColumn("AccountNo"));
    2.             oRadGridView.Columns.Add(new GridViewTextBoxColumn("BankName"));
    3.             oRadGridView.Columns.Add(new GridViewTextBoxColumn("AccountName"));
    1.             oRadGridView.Columns.Add(new GridViewTextBoxColumn("AccountNo"));
    2.             oRadGridView.Columns.Add(new GridViewTextBoxColumn("BankName"));
    3.             oRadGridView.Columns.Add(new GridViewTextBoxColumn("AccountName"));
    1.             oRadGridView.Columns.Add(new GridViewTextBoxColumn("AccountNo"));
    2.             oRadGridView.Columns.Add(new GridViewTextBoxColumn("BankName"));
    3.             oRadGridView.Columns.Add(new GridViewTextBoxColumn("AccountName"));
    1.             oRadGridView.Columns.Add(new GridViewTextBoxColumn("AccountNo"));
    2.             oRadGridView.Columns.Add(new GridViewTextBoxColumn("BankName"));
    3.             oRadGridView.Columns.Add(new GridViewTextBoxColumn("AccountName"));
  2. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 27 Mar 2015 Link to this post

    Hello Mudzakkir,

    Thank you for writing.

    Here is a sample code snippet demonstrating how to set up the columns manually and bind the RadMultiColumnComboBox:
    public Form1()
    {
        InitializeComponent();
     
        DataTable dt = new DataTable();
        for (int i = 0; i < 10; i++)
        {
            dt.Columns.Add("Col" + i);
        }
        for (int i = 0; i < 50; i++)
        {
            DataRow r = dt.NewRow();
            foreach (DataColumn c in dt.Columns)
            {
                r[c.ColumnName] = "data" + i + "." + dt.Columns.IndexOf(c);
            }
            dt.Rows.Add(r);
        }
     
        this.radMultiColumnComboBox1.EditorControl.AutoGenerateColumns = false;
        GridViewTextBoxColumn c1 = new GridViewTextBoxColumn("Col4");
        c1.FieldName = "Col4";
        this.radMultiColumnComboBox1.EditorControl.Columns.Add(c1);
        GridViewTextBoxColumn c2 = new GridViewTextBoxColumn("Col5");
        c2.FieldName = "Col5";
        this.radMultiColumnComboBox1.EditorControl.Columns.Add(c2);
     
        GridViewTextBoxColumn c3 = new GridViewTextBoxColumn("Col7");
        c3.FieldName = "Col7";
        this.radMultiColumnComboBox1.EditorControl.Columns.Add(c3);
     
     
        this.radMultiColumnComboBox1.DataSource = dt;
        this.radMultiColumnComboBox1.DisplayMember = "Col4";
        this.radMultiColumnComboBox1.ValueMember = "Col7";
    }

    Please refer to the MulticolumnComboBox >> DataBinding help article.

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

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top