How to set the RadGrid to Auto-resize the height to fit the page size?

1 Answer 4942 Views
Grid
LamKhoa
Top achievements
Rank 1
LamKhoa asked on 02 Aug 2011, 08:37 PM
Some row take up to 3 or 4 lines (wrap), some row only take up to one line. I would like to know if RadGrid has feature to automatically resize the height to fit each page size?

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Pavlina
Telerik team
answered on 03 Aug 2011, 06:46 PM
Hi Lamkhoa,

If you want the RadGrid control to expand vertically, depending on the number of its rows, you can  use the following CSS rule:

.MyGridClass .rgDataDiv
{
height : auto !important ;
}

"MyGridClass" is some custom CSS class to the RadGrid control, that you should set to prevent the CSS rule be applied to all RadGrid instances on the page / website.

Greetings,
Pavlina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

LamKhoa
Top achievements
Rank 1
commented on 03 Aug 2011, 10:12 PM

I got it. Thanks.
Daniel Aquere
Top achievements
Rank 2
commented on 26 Nov 2011, 07:08 PM

Hi Pavlina,

Very good your suggestion.

Please, how can I use UseStaticHeaders="true" together with your suggestion? I tried, but, doesn´t works.

Thanks, best

Daniel
Pavlina
Telerik team
commented on 28 Nov 2011, 11:01 AM

Hello Daniel Aquere,

Please examine the help article below and let me know if it works for you:
http://www.telerik.com/help/aspnet-ajax/grid-change-scroll-height-at-runtime.html

Regards,
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
Nadav
Top achievements
Rank 1
commented on 21 Apr 2013, 03:29 PM

Pardon me, 
There is no problem
KidSysco
Top achievements
Rank 1
commented on 29 May 2014, 07:38 PM

I would like to know why this happens. I need to apply this fix only on some radgrids in order to get them to work in Chrome. Can we get some more info on this?
Pavlina
Telerik team
commented on 03 Jun 2014, 03:16 PM

Hi Ryan,

When scrolling with static headers are enabled grid ScrollHeight property(the height of the control's scrollable area) is set to 300px by default. This fixed height does not allow the grid to auto resize, when the data can not fill the scroll height. However, you can use the client-side GridCreated event to check whether the table height is less than the value of the ClientSettings.Scrolling.ScrollHeight property, and if so, explicitly modify the scroll area height to match the height of the data items as shown in the following article:
http://www.telerik.com/help/aspnet-ajax/grid-resize-grid-with-scrolling-when-less-data.html

I hope this information helps to understand why this happens.

Regards,
Pavlina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Kundan
Top achievements
Rank 1
commented on 19 May 2017, 05:48 AM

  <ClientSettings>
                                                
                                                    <Scrolling AllowScroll="true" FrozenColumnsCount="2" />
                                                    <Resizing AllowColumnResize="true" ResizeGridOnColumnResize="true" AllowResizeToFit="true" />
                                                </ClientSettings>
Timothy
Top achievements
Rank 1
commented on 22 Nov 2017, 07:21 PM

Setting CSS worked for me.  Thanks!
Tags
Grid
Asked by
LamKhoa
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or