473,386 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 5620
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: chuck amadi | last post by:
By the way list is there a better way than using the readlines() to > > >parse the mail data into a file , because Im using > > >email.message_from_file it returns > > >all the data i.e reads one...
1
by: Frank | last post by:
Hi, we are using oracle clients (Release 9.0.1.0.1 - Production) on an NT4 (Service Pack6) computers. the server is a W2K, (Oracle9i Enterprise Edition Release 9.0.1.1.1 - Production With the...
15
by: Michael Rybak | last post by:
hi, everyone. I'm writing a 2-players game that should support network mode. I'm now testing it on 1 PC since I don't have 2. I directly use sockets, and both client and server do...
5
by: Joe Bonavita | last post by:
My Web forms display differently on different machine with the same resolution. The pages are designed to fit in 800*600 res but on some machines with 800*600 the form appears too big. Are there...
1
by: al | last post by:
Greetings, How should I adjust my text size on my 21(inch) screen so it looks nicely fit on client's 17(inch), all are with IE 6? I use 'Larger' text size but it appears large on client's and...
4
by: Abubakar | last post by:
Hi, I am writing a server in C# and client in C++ (pure, not managed). The communication goes on through sockets. In C# I am using NetworkStream to send text data (by converting it to byte array)...
4
by: active | last post by:
I've been looking for a way to determine the DPI (PPI) of the screen. I've found often the suggestion to use: Dim height As Integer = My.Computer.Screen.Bounds.Height Dim width As Integer =...
3
by: Francois | last post by:
I have dynamic controls, and I want to change the display accoring to the client browser resolution. I have tried browser capabilites, but I did not get size. How could I do it ? Thanks....
0
by: raylopez99 | last post by:
keywords: logical coordinates, page coordinates, world coordinates, device coordinates, physical coordinates, screen coordinates, client coordinates. offset rectangle. WYSIWYG rubber rectangle...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.