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

TableLayout:Fixed not working

3 Answers 229 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dan Appleyard
Top achievements
Rank 1
Dan Appleyard asked on 11 May 2010, 09:48 PM
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> 

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 12 May 2010, 07:32 AM
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.
0
Md Toufiqul
Top achievements
Rank 1
answered on 03 Aug 2016, 06:42 PM
What happens when aggregate of Column widths exceeds 100% of Grid Width in this scenario?
0
Maria Ilieva
Telerik team
answered on 08 Aug 2016, 12:32 PM
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.
Tags
Grid
Asked by
Dan Appleyard
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Md Toufiqul
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or