[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Getting Browser Window Size for ASP.NET server side code

Posted on 2009-07-01
5
Medium Priority
?
1,456 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 1500 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

656 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