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

GridDropDownListColumnEditor width

1 Answer 100 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ranro
Top achievements
Rank 1
ranro asked on 07 Jul 2011, 08:19 PM
How do you set the width of a GridDropDownListColumnEditor on the server. 

I have a method tied to OnCreateColumnEditor called "CreateEditor".  It looks something like this

    protected void CreateEditor(object sender, GridCreateColumnEditorEventArgs e)
{
 GridDropDownListColumnEditor operatorEditor = e.ColumnEditor as GridDropDownListColumnEditor;
operatorEditor.ComboBoxControl.DropDownWidth = Unit.Pixel(50);
}

But the width never gets changed to 50px.  It is a lot longer than that.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 08 Jul 2011, 05:37 AM
Hello Ranro,

Try the following code snippet in the ItemDataBound.

C#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
 {
  if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
       GridEditableItem editItem = (GridEditableItem)e.Item;
       GridDropDownListColumnEditor dropDownEditor = (GridDropDownListColumnEditor)editItem.EditManager.GetColumnEditor("Dropdown1");
       dropDownEditor.ComboBoxControl.Width = Unit.Pixel(20);
    }
 }

Also make sure that your DropDownControlType is RadCombobox.

Thanks,
Shinu.
Tags
Grid
Asked by
ranro
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or