multicolumnCombobox change columns name

2 posts, 0 answers
  1. koray
    koray avatar
    7 posts
    Member since:
    Oct 2010

    Posted 31 Jan 2011 Link to this post

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

    }

     

     

     

     

     

     

  2. Svett
    Admin
    Svett avatar
    728 posts

    Posted 03 Feb 2011 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top