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

Set Column Size to Auto Fill

3 Answers 232 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Eng.Bassel Samman
Top achievements
Rank 2
Eng.Bassel Samman asked on 18 Aug 2010, 04:06 PM
Dears,
Is it possible in RadGrid to have column with Auto Fill mode (The column size will be the size of the grid - the sum of other columns sizes). So, this column will occupy all the empty space in the grid.
I tried the following way, I did not set size of one of RadGrid columns and that worked perfectly, that column ocuppied all empty space in the grid. but this way did not work with all internet explorers and not with all screens resultions, So, is there any more professional way?

Thanks in Advance
Best Regards

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 19 Aug 2010, 12:43 PM
Hello Bassel,

The described scenario should work across all browsers if TableLayout="Fixed" for the MasterTableView. If you still have problems, please provide your RadGrid declaration.

Sincerely yours,
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
Eng.Bassel Samman
Top achievements
Rank 2
answered on 19 Aug 2010, 01:05 PM
<telerik:RadGrid ID="grd" runat="server" AutoGenerateColumns="False" GridLines="None" Skin="Office2007" AllowSorting="True">
<MasterTableView TableLayout="Fixed" EditMode="EditForms" CommandItemStyle-HorizontalAlign="Right" Dir="RTL" DataKeyNames="ID" AllowMultiColumnSorting="false" ClientDataKeyNames="ID">
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" Resizable="False">
<HeaderStyle Width="35px" />
<ItemStyle HorizontalAlign="Center" Width="55px" />
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn DataField="L1_NAME" HeaderText="x" UniqueName="grdL1_NAME">
<HeaderStyle Width="250px"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="MR_TYPES_L1_NAME_GNDR" HeaderText="x" UniqueName="grdGENDER" HeaderStyle-Width="60px">
<HeaderStyle Width="60px"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="AGE_L1_NAME" HeaderText="x" UniqueName="grdAGE">
<HeaderStyle Width="60px"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="MR_NAMES_L1_NAME_FMLY" HeaderText="x"                                                        UniqueName="grdMR_NAMES_L1_NAME_FMLY">
<HeaderStyle Width="110px"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="NATIONAL_NO" HeaderText="x" UniqueName="grdNATIONAL_NO">
<HeaderStyle Width="100px"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="EMP_NO" HeaderText="x" UniqueName="grdEMP_NO">
<HeaderStyle Width="100px"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="FOLDER_NO" HeaderText="x" UniqueName="grdFOLDER_NO">
<HeaderStyle Width="90px"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="HR_DOCS_DOC_NO" HeaderText="x" UniqueName="grdHR_DOCS_DOC_NO">
<HeaderStyle Width="90px"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridDateTimeColumn DataField="START_DATE" UniqueName="grdSTART_DATE" HeaderText="x"
DataFormatString="{0:yyyy-MM-dd}" HtmlEncode="false">
<HeaderStyle Width="100px"></HeaderStyle>
</telerik:GridDateTimeColumn>
</Columns>
<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn1">
</EditColumn>
</EditFormSettings>
<CommandItemStyle HorizontalAlign="Right"></CommandItemStyle>
</MasterTableView>
<SortingSettings SortedBackColor="white" EnableSkinSortStyles="false" />
<HeaderStyle HorizontalAlign="Center" />
<ClientSettings>
<Scrolling AllowScroll="True" ScrollHeight="500px" />
<ClientEvents OnCommand="grd_OnCommand" />
</ClientSettings>
</telerik:RadGrid>

In the pervious declaration you will notice that I gave each column a size in the HeaderStyle, now I want to set the "grdL1_NAME" size to Auto FIll so I removed the HeaderStyle for this column, but this didn't work as I told you. To repreduce the problem please clear HeaderStyle for "grdL1_NAME" column, open the page then double click on the page header to rezize it then you will see that "grdL1_NAME" column isn't visible.
Thanks in Advance
Best Regards
0
Dimo
Telerik team
answered on 19 Aug 2010, 01:42 PM
Hi Bassel,

If I understand you correctly and by "page header"  you mean the browser window titlebar, then the observed behavior is expected.

http://www.telerik.com/community/forums/aspnet/grid/best-practice-for-grid-and-column-widths.aspx#1214355

see point (3):

if the RadGrid resizes together with its parent and you are using static headers, then either set pixel widths to all columns (fixed table layout), or do not set any column widths at all (auto layout). Otherwise when RadGrid shrinks, the columns with no width will be resized to zero width and the users will not see them.

Greetings,
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
Tags
Grid
Asked by
Eng.Bassel Samman
Top achievements
Rank 2
Answers by
Dimo
Telerik team
Eng.Bassel Samman
Top achievements
Rank 2
Share this question
or