how to add horizontal scroll bar to RadGrid

5 posts, 0 answers
  1. Michael
    Michael avatar
    3 posts
    Member since:
    Jul 2012

    Posted 19 Jul 2012 Link to this post

    i have a RadGrid with a lot of columns with autogenerated column headers, is there a way to:
    1) set width for each column individually,
    2) set one common width for all columns,
    3) add a scroll bar for when columns outsize the original size of the grid?

    this can be done either client side or server side.
  2. Pavlina
    Admin
    Pavlina avatar
    6183 posts

    Posted 19 Jul 2012 Link to this post

    Hi Michael,

    Straight to your questions:

    1) You can customize the properties of auto-generated columns at runtime by providing a handler for the grid's ColumnCreated event. In the event handler, cast the column to the appropriate type and set its attributes. More information is available at the bottom part of this help article.

    2) To set common width for all columns you can set MasterTableView Width property to the desired value.

    3) In order to display horizontal scroll for navigation, you need to make sure that the total width of the columns (either auto-generated or declaratively set) exceeds the width of the grid as demonstrated in  this online demo.

    All the best,
    Pavlina
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Niharika
    Niharika avatar
    2 posts
    Member since:
    Apr 2018

    Posted 31 Oct 2018 in reply to Pavlina Link to this post

    How to have a radgrid with height according to its content but if the height exceeds 380px it has a vertical scroll bar?
  4. Niharika
    Niharika avatar
    2 posts
    Member since:
    Apr 2018

    Posted 31 Oct 2018 in reply to Pavlina Link to this post

    How to have a radgrid with height according to its content but if the height exceeds 380px it has a vertical scroll bar
  5. Rumen
    Admin
    Rumen avatar
    13729 posts

    Posted 02 Nov 2018 Link to this post

    Hi Niharika,

    You can wrap the grid in a Div element with applied style="max-height: 380px; overflow-y: auto;" which will show the vertical scroller once the grid height exceeds 380px:

    <div style="max-height: 380px; overflow-y: auto;">
       <telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" ...
    </div>


    Best Regards,
    Rumen
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top