Solved

Getting Browser Window Size for ASP.NET server side code

Posted on 2009-07-01
5
1,280 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 9

Expert Comment

by:AsishRaj
ID: 24759941
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
ID: 24759968
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
ID: 24760476
did you get it working.

Let us know if you need additional help
0
 

Author Comment

by:htourigny
ID: 24761847
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
ID: 24767329
The easiest way would be using Javascript because postback processing happens on server side but javascript is executed on client side.


0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 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