page size...

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

I have a pop window that is displayed and depending on the state of the
system it will contain any number of user controls(ascx). These controls
contain dynamic content and therefore the size of the control can change
dynamically.

Is it possible to work out the size of the page that is going to be
displayed from the code behind page and then resize the pop window
accordingly?

Cheers

Earth Worm Jim
 
Yes I think it is.

I IE you could generally use getBoundingRect() function to retrieve the size of your controls, even if they have no constant size (width or height params within style element)

for example
<script>
function changeWindowSize()
{
var oSizingControl = document.getElementById('sizingControl');
width = oSizingControl.getBoundingClientRect().right - oSizingControl.getBoundingClientRect().left;
height = oSizingControl.getBoundingClientRect().bottom - oSizingControl.getBoundingClientRect().top;

window.resizeTo(width + 25, height + 50);

}
</script>
<body onload="changeWindowSize()">
<asp:Label runat="server" id="sizingControl">Here is my text, i don't know the width and height of</asp:Label>

</body>

I hope that helped...
 
Back
Top