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

Radgrid height not 100%

2 Answers 151 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 10 Aug 2012, 08:54 AM
I've been reading the posts on how you get the radgrid to fill it's container to 100% som that when the user expands the browser window, the grid expands with it. The problem I'm getting is that when set to height=100%, the grid is outside the page. If I make it smaller so it's all visible, then the visible margin to the bottom of the window shrinks when I decrease the window height. Fine, it's percent, right? But you would think the radgrid would stay withing the window, which it doesn't.

When all parent containers and the grid is set to 100%, the grid displays larger than the window. It's contained in a pageview, in a tabstrip.
I believe that the height of 100% set on the grid is somehow not taking the fixed header into account or maybe my user control menu at the very top is offseting the container?

I would appreciate help. My desired look is of true Height = Auto, where the grid would keep a fixed distance from the bottom of the window.

2 Answers, 1 is accepted

Sort by
0
Robert
Top achievements
Rank 1
answered on 10 Aug 2012, 11:22 AM
After digging deeper I can see that it isn't in fact the grid messing it up. It was a div that had 100% height even though the usercontrol menu took up 32px above it, making it overflow.
Isn't there some way to say "100% of remaining space" or "100% minus 30px"?

I am also surprised that setting an item to 100% height doesn't automatically calculate it depending on it's containers height. What is it set to if you don't put anything? Every container manages to calculate a height if nothing is set, so why do you have to set height to 100% in every container up the tree?

I realize this isn't a radgrid question any more but I still would like some tips if you have.
The problem is that the user control menu is 32px high I need to put the div with the grid to WindowHeight - 32px. How do I do that?
0
Robert
Top achievements
Rank 1
answered on 10 Aug 2012, 11:37 AM
Never mind. I found my answer at the bottom here:
CSS: Setting width/height as Percentage minus pixels

The result was this:
#div {
   top: 0; bottom: 0;
   position: absolute;
   width: 100%;
}
and then add some margins.
Tags
Grid
Asked by
Robert
Top achievements
Rank 1
Answers by
Robert
Top achievements
Rank 1
Share this question
or