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

5 posts, 0 answers
  1. Michiel Peeters
    Michiel Peeters avatar
    46 posts
    Member since:
    Apr 2010

    Posted 08 Mar 2011 Link to this post

    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.
  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 08 Mar 2011 Link to this post

    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!
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Michiel
    Michiel avatar
    12 posts
    Member since:
    Feb 2011

    Posted 08 Mar 2011 Link to this post

    Hello Pavlina,

    I'm truly sorry, I forgot to mention that I've already set that property to false.
  5. Michiel Peeters
    Michiel Peeters avatar
    46 posts
    Member since:
    Apr 2010

    Posted 08 Mar 2011 Link to this post

    This is now under the correct account. :)

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

    Best Regards,
    Michiel
  6. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 09 Mar 2011 Link to this post

    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!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017