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

RadGrid tableLayout always fixed.

3 Answers 155 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 12 Jun 2013, 08:43 PM
I need the tablelayout to be Auto but no matter what I try is will not. Here is what I did. Any help would be great.
<telerik:RadGrid ID="RadGrid2" runat="server" GridLines="None"
                            AllowPaging="false" AllowSorting="false" AutoGenerateColumns="false" OnItemCommand="RadGrid2_ItemCommand"
                            ShowStatusBar="false"
                            AllowAutomaticUpdates="True">
                            <MasterTableView DataKeyNames="TeacherNumber,Teacher,LastName,FormerLastName,FirstName,Username,Password,Email,FileFolder,TeacherID,SortPriority,Active" TableLayout="Auto" Width="100%" CommandItemDisplay="None">
                                <Columns>
                                    <telerik:GridEditCommandColumn ButtonType="PushButton" UniqueName="EditCommandColumn">
                                    </telerik:GridEditCommandColumn>
                                    <telerik:GridBoundColumn UniqueName="TeacherNumber" EditFormColumnIndex="0" HeaderText="#" DataField="TeacherNumber">
                                        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="Teacher" EditFormColumnIndex="0" HeaderText="Display Name" DataField="Teacher">
                                        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridDateTimeColumn UniqueName="LastName" EditFormColumnIndex="0" HeaderText="Last" DataField="LastName">
                                        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
                                    </telerik:GridDateTimeColumn>
                                    <telerik:GridBoundColumn UniqueName="FormerLastName" EditFormColumnIndex="0" HeaderText="Former Last" DataField="FormerLastName">
                                        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="FirstName" EditFormColumnIndex="0" HeaderText="First" DataField="FirstName">
                                        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="Username" EditFormColumnIndex="0" HeaderText="Username" DataField="Username">
                                        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="Password" HeaderText="Password" DataField="Password">
                                        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="Email" HeaderText="Email" DataField="Email">
                                        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="FileFolder" HeaderText="File Folder Number" DataField="FileFolder">
                                        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="TeacherID" HeaderText="Teacher ID" DataField="TeacherID">
                                        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="SortPriority" HeaderText="Sort Priority" DataField="SortPriority">
                                        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="Active" HeaderText="Active" DataField="Active">
                                        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
                                    </telerik:GridBoundColumn>
                                </Columns>
</MasterTableView>
                            <ClientSettings>
                                <Scrolling AllowScroll="true" UseStaticHeaders="true"></Scrolling>
                                <ClientEvents OnRowDblClick="RowDblClick"></ClientEvents>
                            </ClientSettings>
                        </telerik:RadGrid>

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 13 Jun 2013, 04:46 AM
Hi,
Your code works fine at my side,Please have a look at this example i have tried.

ASPX:
<telerik:RadGrid ID="RadGrid2" runat="server" GridLines="None" AllowPaging="false"
DataSourceID="SqlDataSource2" AllowSorting="false" AutoGenerateColumns="false"
ShowStatusBar="false" AllowAutomaticUpdates="True">
<MasterTableView TableLayout="Auto" CommandItemDisplay="None">
    <Columns>
        <telerik:GridEditCommandColumn>
        </telerik:GridEditCommandColumn>
        <telerik:GridBoundColumn DataField="CustomerID" HeaderText="OrderID" UniqueName="OrderID" EditFormColumnIndex="0">
        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="CompanyName" HeaderText="CompanyName" UniqueName="CompanyName" EditFormColumnIndex="0" >
        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="ConatactName" HeaderText="ConatactName" UniqueName="ConatactName" >
        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle" UniqueName="ContactTitle" >
        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Address" HeaderText="Address" UniqueName="Address" >
        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="City" HeaderText="City" UniqueName="City" >
        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Region" HeaderText="Region" UniqueName="Region" >
        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="PostalCode" HeaderText="PostalCode" UniqueName="PostalCode" >
        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Country" HeaderText="Country" UniqueName="Country" >
        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Phone" HeaderText="Phone" UniqueName="Phone" >
        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Fax" HeaderText="Fax" UniqueName="Fax" >
        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Number" HeaderText="Number" UniqueName="Number" >
        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="IsFalse" HeaderText="IsFalse" UniqueName="IsFalse" >
        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="id" HeaderText="id" UniqueName="id" >
        <HeaderStyle ForeColor="Black" Font-Bold="true"></HeaderStyle>
        </telerik:GridBoundColumn>
    </Columns>
</MasterTableView>
<ClientSettings>
    <Scrolling AllowScroll="true" UseStaticHeaders="true"></Scrolling>
</ClientSettings>
</telerik:RadGrid>

Thanks,
Princy
 
0
Matt
Top achievements
Rank 1
answered on 13 Jun 2013, 01:55 PM
Nope here is the output. Table layout is still = table-layout: fixed;


<table class="rgMasterTable rgClipCells" rules="cols" border="1" id="ctl00_ContentPlaceHolder_main_RadGrid2_ctl00_Header" style="width: 100%; table-layout: fixed; overflow: hidden; empty-cells: show;">
    <colgroup>
        <col style="width: 57px;">
        <col style="width: 32px;">
        <col style="width: 83px;">
        <col style="width: 74px;">
        <col style="width: 62px;">
        <col style="width: 61px;">
        <col style="width: 95px;">
        <col style="width: 76px;">
        <col style="width: 188px;">
        <col style="width: 65px;">
        <col style="width: 74px;">
        <col style="width: 63px;">
        <col style="width: 55px;">
    </colgroup>
<thead>
        <tr>
            <th scope="col" class="rgHeader"> </th><th scope="col" class="rgHeader" style="color:Black;font-weight:bold;">#</th><th scope="col" class="rgHeader" style="color:Black;font-weight:bold;">Display Name</th><th scope="col" class="rgHeader" style="color:Black;font-weight:bold;">Last</th><th scope="col" class="rgHeader" style="color:Black;font-weight:bold;">Former Last</th><th scope="col" class="rgHeader" style="color:Black;font-weight:bold;">First</th><th scope="col" class="rgHeader" style="color:Black;font-weight:bold;">Username</th><th scope="col" class="rgHeader" style="color:Black;font-weight:bold;">Password</th><th scope="col" class="rgHeader" style="color:Black;font-weight:bold;">Email</th><th scope="col" class="rgHeader" style="color:Black;font-weight:bold;">File Folder Number</th><th scope="col" class="rgHeader" style="color:Black;font-weight:bold;">Teacher ID</th><th scope="col" class="rgHeader" style="color:Black;font-weight:bold;">Sort Priority</th><th scope="col" class="rgHeader" style="color:Black;font-weight:bold;">Active</th>
        </tr>
    </thead><tbody style="display:none;"><tr><td colspan="13"></td></tr></tbody>
</table>


0
Princy
Top achievements
Rank 1
answered on 14 Jun 2013, 08:35 AM
Hi,

Please have a look at this forum,it says some do's and dont's. for Grid and column width.
Try this and see if this helps you.

Thanks,
Princy
Tags
Grid
Asked by
Matt
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Matt
Top achievements
Rank 1
Share this question
or