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

Column width changes in Edit Mode

1 Answer 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard M
Top achievements
Rank 1
Richard M asked on 20 May 2010, 10:38 PM
I have a RadGrid set up with the column widths I want in View mode.  When I click on Edit, all of the column widths change, and the RadGrid runs off the page.  How can I set this so that the columns in Edit mode are the same as my custom column sizes in View mode?

<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" DataSourceID="ds_MainGrid" GridLines="None"  Skin="WebBlue" Width="1025px" AutoGenerateColumns="False" AllowAutomaticUpdates="True" ShowStatusBar="true" ShowFooter="true" >
<HeaderContextMenu EnableAutoScroll="True">
</HeaderContextMenu>
<MasterTableView DataSourceID="ds_MainGrid" DataKeyNames="ID" ClientDataKeyNames="ID" EditMode="InPlace" >
<Columns>
<telerik:GridTemplateColumn UniqueName="TemplateColumn">
<ItemTemplate >
<input id="btn_SelectRow" type="button" value="Select" onclick="openSelectRow();" />
</ItemTemplate>
<HeaderStyle Width="10px" ForeColor="White" />
<ItemStyle Width="10px" ForeColor="White" />
</telerik:GridTemplateColumn>
<telerik:GridEditCommandColumn ButtonType="PushButton">
<HeaderStyle Width="10px" />
<ItemStyle Width="10px" />
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn DataField="ID" HeaderText="ID"  SortExpression="ID"
UniqueName="ID">
<HeaderStyle Width="20px" ForeColor="White" />
<ItemStyle ForeColor="Black" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Orgnum" HeaderText="DEALER NUMBER"  SortExpression="Orgnum"
UniqueName="Orgnum">
<HeaderStyle Width="20px" ForeColor="White" />
<ItemStyle ForeColor="Black" Width="20px"/>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Org" HeaderText="DEALER"  SortExpression="Org"
UniqueName="Org">
<HeaderStyle Width="20px" ForeColor="White" />
<ItemStyle ForeColor="Black" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Last_Name" HeaderText="LAST NAME"  SortExpression="Last_Name"
UniqueName="Last_Name">
<HeaderStyle Width="20px" ForeColor="White" />
<ItemStyle ForeColor="Black" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="First_Name" HeaderText="FIRST NAME"  SortExpression="First_Name"
UniqueName="First_Name">
<HeaderStyle Width="20px" ForeColor="White" />
<ItemStyle ForeColor="Black" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="UserName" HeaderText="USER NAME" SortExpression="UserName"
UniqueName="UserName">
<HeaderStyle Width="20px" ForeColor="White" />
<ItemStyle ForeColor="Black" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Password" HeaderText="PASSWORD" SortExpression="Password"
UniqueName="Password">
<HeaderStyle Width="20px" ForeColor="White" />
<ItemStyle ForeColor="Black" />
</telerik:GridBoundColumn>
<telerik:GridCheckBoxColumn HeaderText="STATUS" UniqueName="Status">
<HeaderStyle Width="20px" ForeColor="White" />
</telerik:GridCheckBoxColumn>
<telerik:GridCheckBoxColumn HeaderText="DMS" UniqueName="DMS">
<HeaderStyle Width="20px" ForeColor="White" />
</telerik:GridCheckBoxColumn>
<telerik:GridCheckBoxColumn HeaderText="LEASE" UniqueName="Lease">
<HeaderStyle Width="20px" ForeColor="White" />
</telerik:GridCheckBoxColumn>
<telerik:GridCheckBoxColumn HeaderText="ONLINE RATING" UniqueName="OnlineRating">
<HeaderStyle Width="20px" ForeColor="White" />
</telerik:GridCheckBoxColumn>
<telerik:GridTemplateColumn>
</telerik:GridTemplateColumn>

</Columns>
</MasterTableView>
<ClientSettings AllowColumnsReorder="True">
</ClientSettings>
</telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Richard M
Top achievements
Rank 1
answered on 20 May 2010, 11:50 PM

I figured out one way to do this.  If I go into Design Mode, and choose the Property Builder in my RadGrid, I can change each column to a Template column and then set the width for EditItemTemplate:

 

<

 

asp:TextBox ID="Column1" runat="server" Text='<%# Bind("Column1") %>' Width="20px"></asp:TextBox>

 

</

 

EditItemTemplate>

 

<

 

ItemTemplate>

 

<

 

asp:Label ID="Label1" runat="server" Text='<%# Eval("Column1") %>' Width="20px"></asp:Label>

 

</

 

ItemTemplate>

 

Tags
Grid
Asked by
Richard M
Top achievements
Rank 1
Answers by
Richard M
Top achievements
Rank 1
Share this question
or