TableLayout:Fixed not working

4 posts, 0 answers
  1. Dan Appleyard
    Dan Appleyard avatar
    6 posts
    Member since:
    Jan 2010

    Posted 11 May 2010 Link to this post

    According to Telerik's documentation for ASP.NET Ajax Controls 2010 Q1's RadGrid -

    "The value of the TableLayout property is a string that specifies or receives one of the following GridTableLayout enumeration values:

    Auto Column width is set by the widest unbreakable content in the column cells.
    Fixed Default. Table and column widths are set either by the sum of the widths on the GridTableView.Columns objects or, if these are not specified, by the width of the first row of cells. If no width is specified for the table, it renders by default with width=100%."

    I have a table that has its TableLayout to fixed.  I have 3 columns - all have fixed widths.  Yet when I view the source, the rendered table has a width of 100% and the 3 columns have the same width (they are each a third of the grid).   According to Telerik's documentation, that should not be the case. 

     What is going on?

    Here is my exact markup of the RadGrid:
    <telerik:RadGrid ID="dgCourseCatalog" runat="server" AutoGenerateColumns="False" AllowSorting="true" BorderStyle="None"
                        <MasterTableView ShowHeadersWhenNoRecords="False" AllowNaturalSort="false" TableLayout="Fixed"
                            <SortExpressions> 
                                <telerik:GridSortExpression FieldName="LearningModuleName" SortOrder="Ascending" /> 
                            </SortExpressions> 
                            <NoRecordsTemplate> 
                                <div class="StatusUpdate Warning NoRecords"
                                    No Learning Modules found with your search criteria. Please adjust your search. 
                                </div> 
                            </NoRecordsTemplate> 
                            <Columns> 
                                <telerik:GridTemplateColumn HeaderText="Type" UniqueName="LMType" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center"
                                <ItemStyle Width="30px" Wrap="true" /> 
                                    <ItemTemplate> 
                                        <img src='<%#ResolveUrl(Eval("LMTypeIconUrl"))%>' alt='<%#Eval("LMTypeDescription") %>' /> 
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn> 
                                <telerik:GridHyperLinkColumn HeaderText="Name" DataTextField="LearningModuleName" SortExpression="LearningModuleName" DataNavigateUrlFormatString="~/learning/learningmodulehome.aspx?LMID={0}" 
                                    DataNavigateUrlFields="LearningModuleID" UniqueName="LearningModuleName" ItemStyle-Width="250px" ItemStyle-Wrap="true" /> 
                                <telerik:GridBoundColumn HeaderText="Description" DataField="LearningModuleDescription" UniqueName="LearningModuleDescription" 
                                    SortExpression="LearningModuleDescription" ItemStyle-Width="250px" ItemStyle-Wrap="true" /> 
                            </Columns> 
                        </MasterTableView> 
                    </telerik:RadGrid> 

  2. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 12 May 2010 Link to this post

    Hi Dan,

    You have 3 columns with explicit widths, but if the RadGrid control is wider than the sum of all column widths, the columns will expand. Generally, it is good to leave one column (e.g. the last one) with no width, so that it can adjust, according to the RadGrid width.

    In addition, column width should be set with HeaderStyle-Width, not ItemStyle-Width.

    Regards,
    Dimo
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Md Toufiqul
    Md Toufiqul avatar
    1 posts
    Member since:
    Aug 2016

    Posted 03 Aug in reply to Dimo Link to this post

    What happens when aggregate of Column widths exceeds 100% of Grid Width in this scenario?
  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 08 Aug Link to this post

    Hello Md Toufiqul,

    Can you please provided more information on the exact scenario you have and the issue you are facing? Thus we will be able to revise your case and provide further assistance.

    Regards,
    Maria Ilieva
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top