client screen size and MS suggestion

Discussion in 'ASP .Net' started by =?Utf-8?B?Q2hyaXM=?=, Nov 24, 2004.

  1. 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.
     
    =?Utf-8?B?Q2hyaXM=?=, Nov 24, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?Q2hyaXM=?=

    bruce barker Guest

    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.width;
    document.getElementById('screenY')=window.screen.height;
    </script>

    -- bruce (sqlwork.com)


    "Chris" <> wrote in message
    news:...
    | 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.
    |
     
    bruce barker, Nov 24, 2004
    #2
    1. Advertising

  3. =?Utf-8?B?Q2hyaXM=?=

    Patrice Guest

    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" <> a écrit dans le message de
    news:...
    > 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.
    >
     
    Patrice, Nov 24, 2004
    #3
  4. 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" <> wrote in message
    news:...
    >
    > Problem:
    > I would like to detect, get values for, the screen resolution in px but in
    > a
    > code behind. Is this possible?
    >
     
    Ken Cox [Microsoft MVP], Nov 24, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Russell
    Replies:
    1
    Views:
    378
    Steve C. Orr [MVP, MCSD]
    Jan 21, 2004
  2. Piet
    Replies:
    0
    Views:
    412
  3. Pat
    Replies:
    5
    Views:
    543
  4. Jason Cavett

    Preferred Size, Minimum Size, Size

    Jason Cavett, May 23, 2008, in forum: Java
    Replies:
    5
    Views:
    12,609
    Michael Jung
    May 25, 2008
  5. Biranchi Narayan Panda
    Replies:
    1
    Views:
    2,760
    Alexey Smirnov
    Feb 17, 2010
Loading...

Share This Page