Screen Resolution

  • Thread starter Thread starter MWulfe
  • Start date Start date
M

MWulfe

I'm relatively new to ASP.Net, using VB. I want to paint the client
screen based on its resolution. What is the simplest way I can return
that value (screen width) from a Javascript function?
 
Thanks for the response.

I did not find the page you referred me to as very helpfu (it seems
extreme to have to add an entire new file to my project just to get
theclient's screen resolution!).

I would rather use the javascript screen.width (which I do know
about), but I cannot figure out how to use it in a script so I can
pick up the value from within VB.

Can you help me out with that?

Thanks.
 
I would rather use the javascript screen.width (which I do know
about), but I cannot figure out how to use it in a script so I can
pick up the value from within VB.

The problem is that to get a value from the javascript screen.width
you need to do a postback. And that's what the new page is supposed to
do there. For example, you can use a session variable e.g.
Session("width") to check if it's null -> do redirect to a new page ->
assign Session("width") do the rest.

Generally speaking, the easiest way to size an element relative to the
client screen is to give it a width specified as a percentage. Using
absolute sizing could be a problem when browser is resized or user
changed the default text size.
 
Thanks for your response. It got me to thinking about other ways to solve
my problem, and I have, without the screen resolution. I appreciate your
help!


I would rather use the javascript screen.width (which I do know
about), but I cannot figure out how to use it in a script so I can
pick up the value from within VB.

The problem is that to get a value from the javascript screen.width
you need to do a postback. And that's what the new page is supposed to
do there. For example, you can use a session variable e.g.
Session("width") to check if it's null -> do redirect to a new page ->
assign Session("width") do the rest.

Generally speaking, the easiest way to size an element relative to the
client screen is to give it a width specified as a percentage. Using
absolute sizing could be a problem when browser is resized or user
changed the default text size.
 
Back
Top