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

[Solved] GridDropDownColumn width

4 Answers 597 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Eliyahu Goldin
Top achievements
Rank 1
Eliyahu Goldin asked on 15 Jun 2009, 08:24 PM

How can I limit the dropdown width in edit mode?

<telerik:GridDropDownColumn DataField="Justification" HeaderText="Align" UniqueName="Align"
DataSourceID="xdsAligns" ListTextField="Text" ListValueField="Value"
DropDownControlType="RadComboBox" 
EnableEmptyListItem="false" ItemStyle-Width="9ex" />

4 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 16 Jun 2009, 04:25 AM
Hi Eliyathu Goldin,

Try the following code snippet for setting the width of dropdowncolumn in editmode.

CS:
 
 
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    if(e.Item is GridDataItem && e.Item.IsInEditMode) 
    { 
        GridDataItem item = (GridDataItem)e.Item; 
        RadComboBox combo = (RadComboBox)item["Align"].Controls[0]; // Access the radcombobox in EditMode 
        combo.Width = Unit.Pixel(200); // Set the width 
    } 

-Shinu
0
Eliyahu Goldin
Top achievements
Rank 1
answered on 16 Jun 2009, 06:50 AM
Thanks Shinu,

This works, but having declarative property for dropdowns in Edit mode will make more sense.

Telerik, if you watch this conversation, can you consider it as a feature request?
0
Princy
Top achievements
Rank 2
answered on 16 Jun 2009, 07:39 AM
Hello Eliyahu,

If you want to get this done declaratively, then you can make use of the column editors, which enables you to easily customize the look of the controls for columns that are in EditMode. You can set the editors for various columns declaratively by setting the ColumnEditorID property of the corresponding column to the ID of the custom column editor. Refer to the follwing help document for more information on this.

Thanks
Princy.
0
john
Top achievements
Rank 1
answered on 19 Nov 2009, 05:05 PM
    <telerik:RadGrid ID="LayerMOAAccessoryGrid" runat="server" DataSourceID="LayerMOAAccessoryDatasource" 
        GridLines="None" AutoGenerateDeleteColumn="True" OnDeleteCommand="Grid_DeleteCommand">  
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="LayerMOAAccessoryID" DataSourceID="LayerMOAAccessoryDatasource" 
            AllowAutomaticInserts="true" AllowAutomaticUpdates="true" CommandItemDisplay="Top">  
            <RowIndicatorColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </RowIndicatorColumn> 
            <ExpandCollapseColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </ExpandCollapseColumn> 
            <Columns> 
                <telerik:GridDropDownColumn DataField="LayerMOAID" UniqueName="LayerMOAID" DataSourceID="LayerMOADatasource" 
                    ListValueField="LayerMOAID" ListTextField="Name" HeaderText="Layer / MOA" ColumnEditorID="LayerMOAIDColumnEditor" /> 
                <telerik:GridDropDownColumn DataField="ProductProfileID" UniqueName="ProductProfileID" 
                    DataSourceID="ProductProfileDatasource" ListValueField="ProductProfileID" ListTextField="Name" 
                    HeaderText="Accessory" ColumnEditorID="ProductProfileIDColumnEditor" /> 
            </Columns> 
        </MasterTableView> 
    </telerik:RadGrid> 
    <telerik:GridDropDownListColumnEditor ID="LayerMOAIDColumnEditor" DropDownStyle-Width="400" 
        runat="server" /> 
    <telerik:GridDropDownListColumnEditor ID="ProductProfileIDColumnEditor" DropDownStyle-Width="400" 
        runat="server" /> 
Tags
Grid
Asked by
Eliyahu Goldin
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Eliyahu Goldin
Top achievements
Rank 1
Princy
Top achievements
Rank 2
john
Top achievements
Rank 1
Share this question
or