views:

13

answers:

1

Here's the scenario:
I have an asp.net webpage which displays dynamic data in a gridview.

I'm using a master page to display the header and footer of the page, and this gridview is being displayed inside a div in the contentplaceholder.

The Problem:
What I want is that the size of the page that is displayed remains constant for a user and must be equal to the size of their browser's available display area and the content being visible by scrolling the div.

Sort of like the header and footer remain at the same position and the content inside it is scrollable.

I really don't know how to achieve this.

Any help on the matter is highly appreciated.

Thanks.

+2  A: 

Try some jQuery:

function changeHeight(){
  var winHeight = $(window).height();
  var heightOfHeaderAndFooter = 200px; // change this to what you need
  $('#myDiv').height($(window).height() - heightOfHeaderAndFooter);
}
$(window).resize(function() { // changes height with browser window
  changeHeight();
});
$(document).ready(function() { // changes height on load of the page
  changeHeight();
});

What you want is for your div to use width:auto and to dynamically change the height of it to always keep the footer at the bottom of the page. Also, make sure your div has overflow-y:scroll

Pete Amundson
i assumed that you wanted to only scroll up and down from inside your `div` if this is wrong, let me know
Pete Amundson
Hey Pete, thanks for the reply, but I have no experience of jquery. And after doing some search work, I feel really dumb to have asked such a novice question here(Thanks to my inexperience with css). The layout I wanted to achieve can be done so using the tutorial on this page: <a href="http://www.webreference.com/programming/css_frames/index.html">http://www.webreference.com/programming/css_frames/index.html</a> Though since you were the only one who cared to reply to the post, I'm marking your answer as answered. Thanks!
Anchit