how to increase gridviewmulticombobox grid only

2 posts, 0 answers
  1. Senthil
    Senthil avatar
    1 posts
    Member since:
    Sep 2010

    Posted 03 Dec 2014 Link to this post

    i want to show no of columns in gridviewmulticombox.how to show?
  2. Ralitsa
    Admin
    Ralitsa avatar
    176 posts

    Posted 05 Dec 2014 Link to this post

    Hi Senthil,

    Thank you for contacting us. 

    If you want to display in the header column the number of rows or number of column in front of its name, you can subscribe to ViewCellFormatting event of the EditorControl. Here is the code: 

    void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
    {
        RadMultiColumnComboBoxElement element = e.ActiveEditor as RadMultiColumnComboBoxElement;
        if (element != null)
        {
            element.EditorControl.Columns["DrinkID"].IsVisible = false;

                 element.EditorControl.ViewCellFormatting -= EditorControl_ViewCellFormatting;
            element.EditorControl.ViewCellFormatting += EditorControl_ViewCellFormatting;
        }
    }
     
    void EditorControl_ViewCellFormatting(object sender, CellFormattingEventArgs e)
    {
        if (e.CellElement is GridRowHeaderCellElement && e.RowIndex != -1)
        {
            e.CellElement.Text = e.CellElement.RowIndex.ToString();
        }
        else if (e.CellElement is GridHeaderCellElement)
        {
            e.Column.HeaderText = String.Format("{0}.{1}", e.ColumnIndex, e.Column.Name);
        }
        else
        {
            e.CellElement.ResetValue(LightVisualElement.TextProperty, Telerik.WinControls.ValueResetFlags.Local);
        }
    }

    If you want to increase the width of GridViewMultiComboBoxColumn you can use the following code snippet: 
    GridViewMultiComboBoxColumn col = new GridViewMultiComboBoxColumn();
    col.Width = 200;

    If you want to hide a column in MultiComboBoxColumn, you can use this: 
    void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
    {
        RadMultiColumnComboBoxElement element = e.ActiveEditor as RadMultiColumnComboBoxElement;
        if (element != null)
        {
            element.EditorControl.Columns["DrinkID"].IsVisible = false;
        }
    }

    You can refer to documentation for RadMultiColumnComboBox which demonstrates how to set different properties. 

    I also attached a sample demo application. If this is not what you want to achieve, I would kindly ask you to send me a more detailed explanation. 

    I am looking forward to your reply.

    Regards,
    Ralitsa
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

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