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

how to increase gridviewmulticombobox grid only

1 Answer 111 Views
MultiColumn ComboBox
This is a migrated thread and some comments may be shown as answers.
Senthil
Top achievements
Rank 1
Senthil asked on 04 Dec 2014, 04:23 AM
i want to show no of columns in gridviewmulticombox.how to show?

1 Answer, 1 is accepted

Sort by
0
Ralitsa
Telerik team
answered on 05 Dec 2014, 04:56 PM
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.

 
Tags
MultiColumn ComboBox
Asked by
Senthil
Top achievements
Rank 1
Answers by
Ralitsa
Telerik team
Share this question
or