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

How dataBind MultiColumnComboBox from collection and set autogenerate column false?

1 Answer 184 Views
MultiColumn ComboBox
This is a migrated thread and some comments may be shown as answers.
mudzakkir
Top achievements
Rank 1
mudzakkir asked on 25 Mar 2015, 04:06 AM
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"));

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 27 Mar 2015, 02:07 PM
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.

 
Tags
MultiColumn ComboBox
Asked by
mudzakkir
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or