Solved

Getting Browser Window Size for ASP.NET server side code

Posted on 2009-07-01
5
1,109 Views
Last Modified: 2012-05-07
Hello,
I want to optimize the display of an ASP.NET page according to the client window area of the Browser. Is there a way to get this?

Thank you
Henri
0
Comment
Question by:htourigny
  • 4
5 Comments
 
LVL 9

Expert Comment

by:AsishRaj
Comment Utility
u can get the screen width and height using javascript.


<Script language="javascript">

function getScreenSize()

{

var screenheight=screen.height;

alert(screenheight);

var screenWidth=screen.width

alert(screenWidth);

}

Open in new window

0
 
LVL 9

Expert Comment

by:AsishRaj
Comment Utility
Sorry i didnt see you wanted Server side code

http://www.codeproject.com/KB/aspnet/detectbrowser.aspx

Another one is

 Page.Request.Browser.ScreenPixelsWidth
 Page.Request.Browser.ScreenPixelsHeight



0
 
LVL 9

Expert Comment

by:AsishRaj
Comment Utility
did you get it working.

Let us know if you need additional help
0
 

Author Comment

by:htourigny
Comment Utility
Page.Request.Browser.ScreenPixelsWidth and Page.Request.Browser.ScreenPixelsHeight always give 640 x 480 and the real size is different. This is true also when request is a postback. I tried with IE 7 and IE 8
0
 
LVL 9

Accepted Solution

by:
AsishRaj earned 500 total points
Comment Utility
The easiest way would be using Javascript because postback processing happens on server side but javascript is executed on client side.


0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now