Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get page size?

Status
Not open for further replies.

snobrdinrtiste

Programmer
Aug 22, 2005
24
US
Hi everyone, i'm new to asp.net and i'm trying to get the document's width and height on page load.
I know there are functions that will return the document's width and height in Javascript.... but how would i do it for
.net? Can anyone help me on this? tia, derek
 
snodbrdinrtiste - you might be able to find a way to do this but from the following quote I ran across it may not be that easy since you are trying to carry out code on the server side to evaluate something dependend on client parameters.
You cant achieve this server side only. The client screens width and height varies on various factors like the screen resolution, and you can retrieve these values only in script client side. This will require that you check the clients screen width/height in script, add the values in a hidden field or the querystring, make one postback to the server to pass it the values.

Your server side code will need to retrieve the values from the hiddenfield, or the querystring. There is no alternative. This is a clientside functionality.
It may be possible, but it might involve an additional round trip to the server once the client params are determined. I'd say if you have to do it this way you could probably find something by searching Google Groups - I saw a few arguments about various methodologies to do this but all had restrictions and some level of difficulty.
 
hey Isadore,
thanks for your help.
Yeah, i tried getting the values of the width and height from javascript and putting those values in textboxes...
so i guess i'll probably have to post those values back to the same asp page...
i'm going to try to use ajax to do the post asychonously.
if anyone has any luck with this please let me know.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top