Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > ComboBox and ListBox (obsolete as of Q2 2010) > multicolumnCombobox change columns name

Not answered multicolumnCombobox change columns name

Feed from this thread
  • Posted on Jan 31, 2011 (permalink)

    i m using this method.maybe helpfull some new developers like me.
    public void changeyourcolumnsname()
    {string conn="Data Source=yourdatasource; User Id=youruserid; Password=yourpassword; Initial Catalog =yourdataname;";

     

     

     

     

     

    using

     

     

    (SqlConnection connection = new SqlConnection(conn))

     

    {

    connection.Open();

     

     

     

     

     

    DataSet ds = new DataSet();

     

     

     

     

     

    SqlDataAdapter adp = new SqlDataAdapter("select col1,col2,col3,col4 from yourtable",connection);
    adp.Fill(ds, "yourtable");

     

     

     

     

     

    this.radMultiColumnComboBox1.DataSource = ds.Tables[0];

     

     

     

     

    FilterDescriptor descriptor =

     

     

     

    new FilterDescriptor(this.radMultiColumnComboBox1.DisplayMember, FilterOperator.StartsWith, string.Empty);

     

     

     

     

     

    this.radMultiColumnComboBox1.EditorControl.FilterDescriptors.Add(descriptor);

     

     

     

     

     

    this.radMultiColumnComboBox1.DropDownStyle = RadDropDownStyle.DropDown;

     

     

     

     

     

    this.radMultiColumnComboBox1.EditorControl.Columns[0].HeaderText = "mycolumns1";//change your col1

     

     

     

     

     

    this.radMultiColumnComboBox1.EditorControl.Columns[1].HeaderText = "mycolumns2";//change your col2

     

     

     

     

     

    this.radMultiColumnComboBox1.EditorControl.Columns[2].HeaderText = "mycolumns3";//change your col3

     

     

     

     

     

    this.radMultiColumnComboBox1.EditorControl.Columns[3].HeaderText = "mycolumns4";//change your col4

     

     

     

     

     

     

    connection.Close();

     

    }

     

    private

     

     

     

     

    void yourform_Load(object sender, EventArgs e)

     

    {

     

     

     

    this.radMultiColumnComboBox1.AutoSizeDropDownToBestFit = true;

     

    RadMultiColumnComboBoxElement multiColumnComboElement =

     

    this.radMultiColumnComboBox1.MultiColumnComboBoxElement;

     

    multiColumnComboElement.DropDownSizingMode = SizingMode.UpDownAndRightBottom;

    multiColumnComboElement.DropDownMinSize =

     

    new Size(420, 300);

     

    multiColumnComboElement.EditorControl.MasterGridViewTemplate.AutoGenerateColumns =

     

    false;

     

     

     

     

    this.radMultiColumnComboBox1.AutoFilter = true;

     

     

     


    changeyourcolumnsname();

    }

     

     

     

     

     

     

    Reply

  • Svett Svett admin's avatar

    Posted on Feb 3, 2011 (permalink)

    Hello koray,

    Thank you for the supplied code snippet. I suppose our community will find it useful.

    Best wishes,

    Svett
    the Telerik team

     

    Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > ComboBox and ListBox (obsolete as of Q2 2010) > multicolumnCombobox change columns name
Related resources for "multicolumnCombobox change columns name"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]