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

How to Auto Height and/or max/min Grid height?

6 Answers 2210 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rob Ainscough
Top achievements
Rank 1
Rob Ainscough asked on 18 Oct 2018, 06:08 PM

I'm having NO LUCK trying to get a RadGrid to auto size it's height … here is what I'm trying to achieve (which seems simple to me) within RadPageLayout row:

1.  Set Grid's min-height and max-height

2.  Have the Grid auto size based on content and staying within the confines of min-Height and max-Height

I've search for answers and see the question has come up very often but the solutions are incredibly worky and not reliable for a task that is very simple.  Is there an easy solution to this without having to write 100's of lines of code?

I buy Telerik products to avoid having to write all this code, so I'm hoping this is a simple solution.

Cheers, Rob.

 

6 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 19 Oct 2018, 12:39 PM
Hello Rob,

I advise that you first examine the following article on setting the grid height in percent: https://www.telerik.com/support/code-library/setting-radgrid's-height-in-percents. Once you have the page layout set up so the grid container provides the grid size, you can set up the container to have the desired min and max dimensions as per your design requirements. 


Regards,
Marin Bratanov
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.
0
Rob Ainscough
Top achievements
Rank 1
answered on 19 Oct 2018, 02:55 PM

Hi Marin,

Sorry but I'm not really seeing anything relevant in the link you provided?  It seems to be about RadAjaxPanel?  Or are you suggesting this is the only way and use of have a Grid's min-height and max-height will not work with a RadPageLayout?

Cheers, Rob.

0
Marin Bratanov
Telerik team
answered on 19 Oct 2018, 03:36 PM
Hello Rob,

RadPageLayout is designed to manage width and/or show/hide containers based on the total screen size. The height of an element is something the developer must set in their layout. This is why I advised that you start by making sure you can make the grid fill a generic container, like a <div> whose dimensions you can control (the article also talks about ajax settings to let you know how to AJAX-enable the grid, but the basics boil down to plain HTML + CSS). Once you can have the grid fill the desired container, you can place it in a RadPageLayout. Depending on its settings, that <div> will have some width or even be hidden, but the height is still something you'd have to set.


Regards,
Marin Bratanov
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.
0
Rob Ainscough
Top achievements
Rank 1
answered on 13 Feb 2019, 12:50 AM

FYI, I was never able to resolve this issue using a RadPageLayout with LayoutRow.  I can set the Height="200" on RadGrid and the grid will be limited to a height of 200.

I tried using those samples and AjaxManager but results were the same, when the grid populates ... in my 2 rows plus the header ... I still get a huge 'gap' between the last row and the grid border.  There doesn't appear to be any support for an "Resize" or "AutoSize" the height of the grid.

I suppose I could manually try to calculate the row heights and header heights and then manually set the Grid's height, but that seems a bit "old school".  I was hoping for something in ClientSettings along the lines of the other Resizing options, but nothing exists.

Rob

 

 

1
Rob Ainscough
Top achievements
Rank 1
answered on 13 Feb 2019, 12:57 AM

No sooner than I posted and I found the solution, it was simple also ...

in the ClientSettings for the Grid ... in the Scrolling section simply add ScrollHeight="" 

Rob

0
Rob Ainscough
Top achievements
Rank 1
answered on 13 Feb 2019, 12:57 AM

No sooner than I posted and I found the solution, it was simple also ...

in the ClientSettings for the Grid ... in the Scrolling section simply add ScrollHeight="" 

Rob

Tags
Grid
Asked by
Rob Ainscough
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Rob Ainscough
Top achievements
Rank 1
Share this question
or