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

how to add horizontal scroll bar to RadGrid

4 Answers 1351 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 19 Jul 2012, 07:01 AM
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.

4 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 19 Jul 2012, 09:17 AM
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.
0
Niharika
Top achievements
Rank 1
answered on 31 Oct 2018, 03:43 PM
How to have a radgrid with height according to its content but if the height exceeds 380px it has a vertical scroll bar?
0
Niharika
Top achievements
Rank 1
answered on 31 Oct 2018, 03:44 PM
How to have a radgrid with height according to its content but if the height exceeds 380px it has a vertical scroll bar
0
Rumen
Telerik team
answered on 02 Nov 2018, 08:47 AM
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.
Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Niharika
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or