?
Solved

Dynamically size a grid based on availabe screen height

Posted on 2011-02-19
2
Medium Priority
?
432 Views
Last Modified: 2012-05-11
I am using Masterpage and contentpages... on the content pages I have a header and a middle section and I have a grid on the bottom.

I want to size that grid so it takes up the rest of the available space on the screen... in old vb it would be something like Screen.height - grid.top = grid.height.

Thank you!
0
Comment
Question by:md0333
2 Comments
 
LVL 14

Accepted Solution

by:
CtrlAltDl earned 2000 total points
ID: 34946550
You want to use some JavaScript client-side scripting, so it can be calculated correctly for their particular browser.

In my script below it assumes you have a header div and a footer div.  It subtracts the header and footer from the browsers available view space and resizes your grid (myGrid) to the available space.

<script type="text/javascript">
function resizeContent() {
     //Get/Set your available height
     var availHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
     var footerHeight = document.getElementById("footerDiv").offsetHeight;
     var headerHeight = document.getElementById("headerDiv").offsetHeight;
     
     availHeight = footerHeight - headerHeight - availHeight;
     
     document.getElementById("myGrid").setAttribute("height", availHeight);
</script>

Open in new window

0
 

Author Comment

by:md0333
ID: 34948679
Thank you!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question