Control Scaling???

G

Guest

I have 2 controls on a page that need to be defined by absolute horiz. and
vert. sizes, and both need to be a percentage of the screen size. Does anyone
know of a easy way to grab the screen extents, divide them by fractions that
can then be assigned to the controls on initialization.

I am working in C# in ASP.Net!
 
S

Steven Cheng[MSFT]

Hi Dewright,

Welcome to ASP.NET newsgroup.
As for the grabing the screen size of clientside in asp.net page, here are
some of my suggestions:

Since the screen size is the clientside information, currently we could
only retrieve it through clientside scripts. The problem is that clientside
scripts need to be executed at clientside (browser context), so we need to
at least let our page be render to client once to get those info. Since
you need to get the screen size so as to coordinate your serverside
control's size, I think we have the following means:

1. We retreive the clientside screen size in client script and also use
client script to modify our server control's size( through the attributes
of the controls' rendered html elements at client)

2. We use client script to get the screen size and post back to server
again and adjust the control's size in serverside code. This'll need an
additional roundtrip to clientside.

Here is a web link which provide the clientscripts on how to get the screen
size at clientside;

#Screen Size
http://www.javascripter.net/faq/screensi.htm

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
G

Guest

Great stuff, you are always a great source of info. To go along with this
then is there a easy way to take these values from the Javascript and add
them to my session variables? I will pass them from page to page to scale the
individual controls appropriatley.

Thanks Steven!
 
S

Steven Cheng[MSFT]

Thanks for your sincere reply,

I'm very glad that my suggestion was of assistance. As for the further
question you mentioned, I think we can consider the following approach:

Since you said that you'll retrieve this information just at the first time
the user visited the application and then cache them in Session, I think we
can makeing a particular page which is used to collect such clientside
information. So when the user visit our web application, we can check the
session state( or maybe a flag in cookie) which indicate whether we've
cached the user's clientside info or not. If not, we store the current
requested page's address and then redirect to the particular page the
particular page collect the information through those client scripts
mentioned in former message and postback to store the collected info into
session. After that , the user is redirected to the originally requesting
page.

How do you think of this? Please feel free to let me know if you have any
other questions or ideas.

Thanks & Regards,

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top