vinod
vinod

Reputation:

Dynamically setting screen resolution in Asp.Net(C#) .net framework 1.0

I have designed a page with all asp.net controls which is well alligned in 1024*1024 resolution but in other resolution it gets misalligned..please help

if we cant change the resolution then please tell me what i have to do..

Upvotes: 0

Views: 8809

Answers (4)

Meetu Choudhary
Meetu Choudhary

Reputation: 1355

the best way to perform this task is make multiple css for different screen resolutions and then use one according to that if you like the idea then i can give you the code sample for this i have implemented the same way and now silverlight gives more nice solution. you can look it in my blog. Hope it helps you.

Upvotes: 0

Fredrik Mörk
Fredrik Mörk

Reputation: 158309

You can't change the resolution and I am glad it is like that. I get annoyed when a page resizes the browser. If a page changed my screen resolution it would probably be the safest way to get me to never, ever again visit that site. In short: I think you are attacking the problem from the wrong angle.

What you need to do is to change your design. You cannot change the world to fit your needs, you will need to adopt your app to the world. So the solution is simple:

  • Run your app on a resolution where it looks bad
  • Find out exactly why it looks bad
  • Fix it (typically this will involve using %-based sizing instead of absolute units)

It's usually really not that hard to get a page flexible enough to work on screens ranging from, say 800x600 and upwards. If it looks a bit strange on a high-resolution monitor (such as 1920x1200) it is usually not a problem; when I use a resolution like that, I typically do not have the web browser maximized.

Google for how to design web sites for different resolutions. You should find plenty of information.

Upvotes: 1

Michael Petrotta
Michael Petrotta

Reputation: 60902

Are you seriously asking to modify the client's screen resolution from ASP.NET? No, you can't do this.

Explore your layout options. Look at relative CSS formatting (width: 80%; vs. width: 800px). At worst, discover the client's resolution and adjust.

From http://particletree.com/features/dynamic-resolution-dependent-layouts/

function getBrowserWidth(){
    if (window.innerWidth){
        return window.innerWidth;}  
    else if (document.documentElement && document.documentElement.clientWidth != 0){
        return document.documentElement.clientWidth;    }
    else if (document.body){return document.body.clientWidth;}      
        return 0;
}

...

var browserWidth = getBrowserWidth();

if (browserWidth < 750){
    // thin layout
}
else
{
    // fat layout
}

Upvotes: 3

Matthew Flaschen
Matthew Flaschen

Reputation: 284796

It sounds like your CSS is too inflexible. If you're trying to change the client's screen resolution, it's not gonna work.

Upvotes: 0

Related Questions