dynamic screen

Posted on 2006-05-01
Last Modified: 2012-06-21
how to get an client screen resolution and depending on that screen resolution, how to change our web page in using "css" file .

I got a sample in C# but i want in script

here is the link to that c# sample ""
please go through that link.

sample should be in script not in c#

Thanks in advance
Question by:cakurien
    LVL 10

    Accepted Solution


    u can do it thru javascript using:

    screen.colorDepth: will give color depth (24 bit etc)
    screen.width  and screen.height will give the resolution i.e. 800 x 600  etc..


    LVL 15

    Assisted Solution

    LVL 6

    Expert Comment

    If are you using 2.0 I suggest you to change look of the pages by various web themes e.g. theme800 and theme1204 etc. Look at this example and for more inforamtion to this web page
    This example would run only when you have Theme800 and Theme1024 folders in your App_Themes folder. You can then add to your theme folders style files e.g. like this:
        font-size: 150%;


        font-size: 50%;

    <%@ Page Language="VB" Theme="Theme800" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

    <script runat="server">
        Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
            If Request("RESBOX") <> Nothing Then
                Theme = "Theme" + Request("RESBOX")
            End If
        End Sub

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        End Sub

        Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        End Sub

    <html xmlns="" >
    <head runat="server">
        <title>Untitled Page</title>
        <form id="form1" runat="server">
            <br />
            <asp:TextBox ID="RESBOX" runat="server"></asp:TextBox></div>
            <input id="Button1" type="button" value="Get resolutuin" onclick="document.getElementById('RESBOX').value = screen.width;" />        
            <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Refresh" />

    LVL 15

    Expert Comment

    Just for future use I find this site really good at translating VB.NEt to C# and back again

    So if you find a C# example copy and paste it into the translator and you are done ;)

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    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

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now