469,610 Members | 1,862 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,610 developers. It's quick & easy.

client screen size and MS suggestion

I think I placed this in the wrong news group so I'm moving it here.

Suggestion to Microsoft make the categories more clear and make better
sense. ASP.NET should be its own group, why bury under Framework. And I see
others doing the same mis-posting to dotnet.general which appears to be
gearded more towards windows applications. What are General and Framework for
options under .NET Development!

After exhausting my search on the MS website, I can't find a straight answer.
I find it hard to believe that MS left our something so useful in ASP.NET as
screen resolution detection.

Problem:
I would like to detect, get values for, the screen resolution in px but in a
code behind. Is this possible?

There is a System.Windows.Forms.Screen class for the Windows client side,
why are there none for browser/ASP.NET client?

thank you.

Nov 18 '05 #1
3 5429
the easy answer is the browser does not send the client screen resolution
and the server code has no access to the client machine. you can write
javascript to capture it, and post the values with a sniffer page (usually
the entry page of the site). while you can control general layout this way,
there is no way for the server to know the size of strings in pixels,
because it will not know the fonts/sizes actually used by the client
browser. also the size of the browser window is more important than the
screen resolution, and the user can easily change this.

add this to every page, and you can know the resolution on every postback.
(save it in session for GET renders)

<input type=hidden name=screenX id=screenX runat=server>
<input type=hidden name=screenY id=screenY runat=server>
<script>
document.getElementById('screenX')=window.screen.w idth;
document.getElementById('screenY')=window.screen.h eight;
</script>

-- bruce (sqlwork.com)
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
| I think I placed this in the wrong news group so I'm moving it here.
|
| Suggestion to Microsoft make the categories more clear and make better
| sense. ASP.NET should be its own group, why bury under Framework. And I
see
| others doing the same mis-posting to dotnet.general which appears to be
| gearded more towards windows applications. What are General and Framework
for
| options under .NET Development!
|
| After exhausting my search on the MS website, I can't find a straight
answer.
| I find it hard to believe that MS left our something so useful in ASP.NET
as
| screen resolution detection.
|
| Problem:
| I would like to detect, get values for, the screen resolution in px but in
a
| code behind. Is this possible?
|
| There is a System.Windows.Forms.Screen class for the Windows client side,
| why are there none for browser/ASP.NET client?
|
| thank you.
|
Nov 18 '05 #2
Please avoid to create multiple threads for the same subject.

Keep in mind that ASP.NET is all about server side. There is no HTTP/HTML
mecanism that automagically sends this info to the server. You'll have to
use js to find out those values and post it yourself.

The whole story may also help (if this is to position elements, you may want
to see if HTML doesn't allow to "autoplace" those element such as just by
centering)

Patrice

--

"Chris" <Ch***@discussions.microsoft.com> a écrit dans le message de
news:A2**********************************@microsof t.com...
I think I placed this in the wrong news group so I'm moving it here.

Suggestion to Microsoft make the categories more clear and make better
sense. ASP.NET should be its own group, why bury under Framework. And I see others doing the same mis-posting to dotnet.general which appears to be
gearded more towards windows applications. What are General and Framework for options under .NET Development!

After exhausting my search on the MS website, I can't find a straight answer. I find it hard to believe that MS left our something so useful in ASP.NET as screen resolution detection.

Problem:
I would like to detect, get values for, the screen resolution in px but in a code behind. Is this possible?

There is a System.Windows.Forms.Screen class for the Windows client side,
why are there none for browser/ASP.NET client?

thank you.

Nov 18 '05 #3
Hi Chris,

There are tricks to get client-side information back to the server but it
requires a postback.

If you check out this page and its control, you'll see that the size of the
window is returned:

http://www.metabuilders.com/Tools/ResizeMonitor.aspx

Ken

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...

Problem:
I would like to detect, get values for, the screen resolution in px but in
a
code behind. Is this possible?


Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Michael Rybak | last post: by
5 posts views Thread by Joe Bonavita | last post: by
4 posts views Thread by active | last post: by
3 posts views Thread by Francois | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.