• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 453
  • Last Modified:

dynamic screen

how to get an client screen resolution and depending on that screen resolution, how to change our web page in asp.net using "css" file .

I got a sample in C# but i want in vb.net script

here is the link to that c# sample "http://www.codeproject.com/aspnet/DynamicScreens.asp
please go through that link.


sample should be in vb.net script not in c#

Thanks in advance
0
cakurien
Asked:
cakurien
2 Solutions
 
SystemExpertCommented:
Hi,

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..


or

http://docs.sun.com/source/816-6408-10/screen.htm

Thanks
0
 
deepaknetCommented:
0
 
the_paabCommented:
If are you using asp.net 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 http://odetocode.com/Blogs/scott/archive/2006/03/12/3091.aspx:
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:
style800.css:
body
{
    font-size: 150%;
}

and

style1024.css
body
{
    font-size: 50%;
}
------------------------------------example--------------

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<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
        Response.Write(Theme)
    End Sub

   
    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
       
    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        &nbsp;&nbsp;
        <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" />
    </form>
</body>
</html>


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

http://carlosag.net/Tools/CodeTranslator/Default.aspx

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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now