how to set the resolution of a web page created in asp.net?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pooja8389
    New Member
    • Sep 2010
    • 22

    how to set the resolution of a web page created in asp.net?

    how can we set the resolution of a web page created in asp.net?
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    You don't?
    What are you trying to do?

    -Frinny

    Comment

    • jagdeep gupta
      New Member
      • Aug 2010
      • 98

      #3
      Actually question was also asked from me in an interview so if there is any method please suggest he give me hint if this is done by checking the properties of project

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        You can't really do this in ASP.NET because ASP.NET is a server-side technology. That means that it is not aware of client side stuff like "resolution ". Therefore, you would have to some how check the resolution of the user's computer using a client-side scripting language like JavaScript to set the "resolution ".

        So, you would have to set a HiddenField or Cookie with the window's resolution using JavaScript and post back to the server (you could simply do this by calling the __doPostbackMet hod). Only do this if cookie/HiddenField hasn't been set yet.

        Then on the server you could retrieve this value and choose images etc according to the resolution indicated in the HiddenField or cookie.

        This is a very round-about-way to do things though.
        I would probably just use CSS that didn't depend on the resolution. Using things like percentages and "em" to set the height and width of things. That way I can avoid "resoultion " issues.

        -Frinny
        Last edited by Frinavale; Sep 8 '10, 01:07 PM.

        Comment

        • dip_developer
          Recognized Expert Contributor
          • Aug 2006
          • 648

          #5
          I would always prefer to set height/width of any control of my web page in percentage(%).. ...thats how resolution doesn't effect on the layout of your web page.....

          Comment

          • jagdeep gupta
            New Member
            • Aug 2010
            • 98

            #6
            How to set the width height of master page according to screen of different type computers?

            Comment

            • Frinavale
              Recognized Expert Expert
              • Oct 2006
              • 9749

              #7
              Have you considered setting the width of the control to be a percentage value?

              Eg
              Code:
              style="width:50%;"
              -Frinny

              Comment

              Working...