Allowing grid to resize to widow width on load except for one column

2 posts, 0 answers
  1. Trisha
    Trisha avatar
    2 posts
    Member since:
    Feb 2018

    Posted 25 Apr 2018 Link to this post

    Each column has a set width by setting HeaderStyle-Width. for the Resizing i also have <Resizing AllowRowResize="False" AllowColumnResize="True" EnableRealTimeResize="True"
    ResizeGridOnColumnResize="False" AllowResizeToFit="true"   ></Resizing>.

     

    There is a certian column i have that is just a button and i would really like it be a certian width all the time whille all the other column adjust to the screen size (if screen is larger than the grid)

     

    Is there a way to do this in telerik or is this a feature i would have to request?

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4931 posts

    Posted 27 Apr 2018 Link to this post

    Hello Trisha,

    Setting a fixed width on a column will keep it from resizing. Here is a basic example and below is attached a video that shows the expected behavior.

    <div style="width: 80%">
        <telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" DataSourceID="SqlDataSource1" runat="server" AllowPaging="True"
            GridLines="None" PageSize="10">
            <ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true">
                <Resizing AllowRowResize="False" AllowColumnResize="True" EnableRealTimeResize="True"
                    ResizeGridOnColumnResize="False" AllowResizeToFit="true"></Resizing>
            </ClientSettings>
            <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
            <MasterTableView>
                <Columns>
                    <telerik:GridEditCommandColumn HeaderStyle-Width="50px"></telerik:GridEditCommandColumn>
                    <telerik:GridTemplateColumn HeaderStyle-Width="50px">
                        <ItemTemplate>
                            <asp:Button Text="some button" runat="server" />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridButtonColumn HeaderStyle-Width="50px" ButtonType="LinkButton" Text="some link button"></telerik:GridButtonColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </div>
    <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
        ProviderName="System.Data.SqlClient" SelectCommand="SELECT TOP 25 CustomerID, CompanyName, ContactName, ContactTitle, Address, PostalCode FROM Customers"
        runat="server"></asp:SqlDataSource>


    Regards,
    Marin Bratanov
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top