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

Column widths changing with detail tables

1 Answer 234 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 12 Jan 2011, 01:49 PM
When I set the width of columns in a master table view and then open a detail table view the widths in the parent table change, is there away to avoid this?
<telerik:RadGrid ID="grdGroups" runat="server" EnableLinqExpressions="false" 
GridLines="None" AllowFilteringByColumn="True" DataSourceID="GroupsDataSource"
AllowPaging="True" AllowSorting="True"   OnDetailTableDataBind="grdGroups_DetailTableDataBind"
AutoGenerateColumns="False" oninsertcommand="grdGroups_InsertCommand" 
OnUpdateCommand="grdGroups_UpdateCommand" onitemcommand="grdGroups_ItemCommand" 
    >
    <MasterTableView autogeneratecolumns="False" Name="grdGroups" datakeynames="GroupID" CommandItemDisplay="Top" datasourceid="GroupsDataSource" CommandItemSettings-AddNewRecordImageUrl="~/_resources/images/grid/Grid_AddNew.png" CommandItemSettings-RefreshImageUrl="~/_resources/images/grid/Grid_Hide.png" CommandItemSettings-AddNewRecordText="<%$ Resources:CreateGroup %>" CommandItemSettings-RefreshText="">
        <DetailTables>
  
            <telerik:GridTableView Name="grdGroupEmployees" runat="server" OnItemCommand="grdGroupEmployees_ItemCommand"
                GridLines="None" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" DataKeyNames="UserID"
                AutoGenerateColumns="False" >
                    <RowIndicatorColumn>
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </RowIndicatorColumn>
  
                    <ExpandCollapseColumn>
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </ExpandCollapseColumn>
  
                    <Columns>
                        <telerik:GridBoundColumn DataField="LastName" AutoPostBackOnFilter="true" HeaderText="<%$ Resources:LastName %>" ShowFilterIcon="false"
                            SortExpression="LastName" UniqueName="LastName">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="FirstName" HeaderText="<%$ Resources:FirstName %>" AutoPostBackOnFilter="true" ShowFilterIcon="false"
                            SortExpression="FirstName" UniqueName="FirstName">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Email" HeaderText="Email" AutoPostBackOnFilter="true" ShowFilterIcon="false"
                            SortExpression="Email" UniqueName="Email">
                        </telerik:GridBoundColumn>
                        <telerik:GridButtonColumn ButtonType="ImageButton" ImageUrl="~/_resources/images/grid/Grid_Trash.jpg" ConfirmText="<%$ Resources:RemoveUser%>" Text="<%$ Resources:Main, Archive %>" HeaderText="<%$ Resources: Remove %>" CommandName="RemoveUser" >
                            <HeaderStyle HorizontalAlign="Center" Width="50px" />
                            <ItemStyle HorizontalAlign="Center"  Width="50px" />
                        </telerik:GridButtonColumn>
                        <telerik:GridButtonColumn ButtonType="ImageButton" ImageUrl="~/_resources/images/grid/Grid_Forward.png" Text="<%$ Resources:Main, View %>" HeaderText="<%$ Resources:Main, View %>" CommandName="ViewUser" >
                            <HeaderStyle HorizontalAlign="Center" Width="50px" />
                            <ItemStyle HorizontalAlign="Center"  Width="50px" />
                        </telerik:GridButtonColumn>
                    </Columns>
            </telerik:GridTableView>
        </DetailTables>
          
          
        <RowIndicatorColumn>
            <HeaderStyle Width="20px"></HeaderStyle>
        </RowIndicatorColumn>
  
        <ExpandCollapseColumn>
            <HeaderStyle Width="20px"></HeaderStyle>
        </ExpandCollapseColumn>
  
        <Columns>
            <telerik:GridBoundColumn DataField="Name" AutoPostBackOnFilter="true" UniqueName="Name" HeaderText="<%$ Resources:GroupName %>" ShowFilterIcon="false" SortExpression="Name" >
            </telerik:GridBoundColumn>
            <telerik:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="~/_resources/images/grid/Grid_Edit.png" UpdateImageUrl="~/_resources/images/Grid/Grid_Accept.png"  CancelImageUrl="~/_resources/images/Grid/Grid_Cancel.png" UniqueName="EditCommandColumn"  ItemStyle-Width="50px" HeaderText="<%$ Resources:Main, Edit %>" CancelText="<%$ Resources:Main, Cancel %>" UpdateText="<%$ Resources:Main, Update %>" >
                <HeaderStyle HorizontalAlign="Center" Width="50px" />
                <ItemStyle HorizontalAlign="Center"  Width="50px" />
                <FooterStyle HorizontalAlign="Center"  Width="50px" />
            </telerik:GridEditCommandColumn>
            <telerik:GridButtonColumn ButtonType="ImageButton" ImageUrl="~/_resources/images/grid/Grid_Cancel.png" ConfirmText="Resources:ArchiveConfirm" Text="<%$ Resources:Main, Archive %>" HeaderText="<%$ Resources:Main, Archive %>" CommandName="Archive" >
                <HeaderStyle HorizontalAlign="Center" Width="50px" />
                <ItemStyle HorizontalAlign="Center"  Width="50px" />
            </telerik:GridButtonColumn>
            <telerik:GridButtonColumn ButtonType="ImageButton" UniqueName="ViewGroup" Visible="false" ImageUrl="~/_resources/images/grid/Grid_Forward.png" Text="<%$ Resources: Courses %>" HeaderText="<%$ Resources: Courses %>" CommandName="ViewGroup" >
                <HeaderStyle HorizontalAlign="Center" Width="50px" />
                <ItemStyle HorizontalAlign="Center"  Width="50px" />
            </telerik:GridButtonColumn>
        </Columns>
  
        <EditFormSettings ColumnNumber="1" CaptionDataField="Name" CaptionFormatString="<%$ Resources:EditGroupTitle %> {0}" InsertCaption="<%$ Resources:NewGroupTitle %>">
            <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" Width="60%"  />
            <FormTableStyle CellSpacing="5" CellPadding="2" GridLines="None" />
            <EditColumn ButtonType="ImageButton" InsertText="<%$ Resources:Main, Insert %>" UpdateText="<%$ Resources:Main, Update %>" InsertImageUrl="~/_resources/images/grid/Grid_Accept.png" UpdateImageUrl="~/_resources/images/grid/Grid_Accept.png"
                UniqueName="EditCommandColumn1" CancelText="<%$ Resources:Main, Cancel %>"  CancelImageUrl="~/_resources/images/grid/Grid_Cancel.png">
            </EditColumn>
        </EditFormSettings>
    </MasterTableView>
</telerik:RadGrid>
  
<asp:ObjectDataSource ID="GroupsDataSource" runat="server" 
SelectMethod="GetClientsGroups" TypeName="i2d2Main" SortParameterName="sort">
<SelectParameters>
    <asp:SessionParameter Name="ClientID" SessionField="ClientID" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 13 Jan 2011, 10:28 AM
Hello Jonathan,

Set the TableLayout of the MasterTableView to Fixed . This should help resolve your design issue.

<MasterTableView TableLayout="Fixed"/>

Thanks,
Princy.

Tags
Grid
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or