GridDropDownListColumnEditor width

2 posts, 0 answers
  1. ranro
    ranro avatar
    50 posts
    Member since:
    Aug 2007

    Posted 07 Jul 2011 Link to this post

    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.

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 08 Jul 2011 Link to this post

    Hello Ranro,

    Try the following code snippet in the ItemDataBound.

    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.

  3. DevCraft R3 2016 release webinar banner
Back to Top