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

Control GridDropDownColumn width

3 Answers 110 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 17 Jul 2008, 06:49 AM
Hi,

How can I control the width of the GridDropDownColumn when it is part of a grid who has edit mode set to in-line?

It seems I can control the width of the column when it is in read mode, but when I switch to edit or insert mode, the width expands to some arbitrary amount that I am unable to (yet) define.

Thanks,

Adam

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 17 Jul 2008, 07:41 AM
Hi Adam,

Try the following code snippet to set the width of the GridDropDownColumn in edit mode.

ASPX:
 <telerik:GridDropDownColumn DataField="FirstName" DropDownControlType="DropDownList" HeaderText="Nam" UniqueName="Name">                         
          </telerik:GridDropDownColumn>   

CS:
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode)) 
        { 
            GridEditableItem edititem=(GridEditableItem)e.Item; 
            DropDownList ddl = (DropDownList)edititem["Name"].Controls[0]; 
            ddl.Width = Unit.Pixel(300); 
        } 
   } 


Thanks
Princy.
0
Sebastian
Telerik team
answered on 17 Jul 2008, 07:46 AM
Hi guys,

Additionally, to customize the appearance of the grid editors, consider using declarative style editors.

Greetings,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Adam
Top achievements
Rank 1
answered on 17 Jul 2008, 11:25 PM
Thanks,

The code-behind change worked.

Cheers,

Adam.
Tags
Grid
Asked by
Adam
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Sebastian
Telerik team
Adam
Top achievements
Rank 1
Share this question
or