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

[VB.NET/Columns] Columns resize even when fixed width is set

4 Answers 135 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michiel Peeters
Top achievements
Rank 1
Michiel Peeters asked on 08 Mar 2011, 09:17 AM
Current environment:

ASP.NET (3.5 / VB.NET)
Telerik Controls Q2 2010
Visual Studio 2010 Ultimate

Problem:

Currently I have a user control where the radgrid is placed on and gets dynamically loaded via the code behind of the user control. This radgrid contains 2 columns that have a fixed width of 30 Pixels. Somehow when I add an extra column (so my grid consists 3 columns) the first 2 columns gets also resized even when I have set those columns a fixed width by the HeaderStyle and even the ItemStyle property. I have also set my radgrid with the TableLayout fixed and in the scrolling I've set the staticheader to true (in the below code sample you see the current radgrid).

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="true" HeaderStyle-Wrap="false" EnableHeaderContextMenu="true"
EnableViewState="false" AllowPaging="true" PageSize="20" Skin="Default"
EnableEmbeddedScripts="false" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false" RegisterWithScriptManager="false"
AllowSorting="true" GroupingEnabled="false">
<MasterTableView TableLayout="Fixed" />
<PagerStyle AlwaysVisible="true" Mode="NextPrevAndNumeric" />
<ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true" ColumnsReorderMethod="Reorder"
        Resizing-AllowColumnResize="true" Resizing-ResizeGridOnColumnResize="true" >
        <Scrolling UseStaticHeaders="true" AllowScroll="true" ScrollHeight="20px" />
</ClientSettings>
</telerik:RadGrid>

When I move my screen to a greater screen with a resolution of 1920 those fixed columns are also getting resized which what I don't want.

Thank you in advance.

4 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 08 Mar 2011, 10:42 AM
Hello Michiel,

Try setting the Resizable property to false for those columns which you do not want to resize and let me know how it goes.

Regards,
Pavlina
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Michiel
Top achievements
Rank 1
answered on 08 Mar 2011, 10:52 AM
Hello Pavlina,

I'm truly sorry, I forgot to mention that I've already set that property to false.
0
Michiel Peeters
Top achievements
Rank 1
answered on 08 Mar 2011, 11:48 AM
This is now under the correct account. :)

Like I said before the property Resizable is already set to false.

Best Regards,
Michiel
0
Pavlina
Telerik team
answered on 09 Mar 2011, 03:24 PM
Hi Michiel,

I already have answered your support ticket on the subject. for convenience I will paste my answer here as well:

The observed behavior is expected, although it may look otherwise.

By default, the TableLayout of the MasterTableView is "Auto", which means that columns expand according to their content. Setting TableLayout to "Fixed" leads to all columns having the same width and shrinking to fit the available space. This occurs unless you specify explicit column widths.

If all columns have a fixed pixel width, then the sum of all widths must match the RadGrid width, otherwise the columns expand to fill up the available space. In such cases it is good to leave one column without a width (e.g. the last one), so that it can adjust automatically.

Therefore, to resolve the problem you are facing you could leave at least one column with no width, so that it adjust automatically, according to the available space.

Additionally, I recommend that you examine the following forum thread, which describes the best practice for Grid and Column widths:
http://www.telerik.com/community/forums/aspnet/grid/best-practice-for-grid-and-column-widths.aspx

Let us know if you need additional assistance.

Best wishes,
Pavlina
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Grid
Asked by
Michiel Peeters
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Michiel
Top achievements
Rank 1
Michiel Peeters
Top achievements
Rank 1
Share this question
or