Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing an asp.net application, i need to get the resolution of client machine( i am using Java script for this) and set these values in server side so that page would be displayed according to resolution of client machine, but i am unable to do it.

so my question is ,How to use java script values into ASP.net site


Thanks
Posted
Updated 25-Apr-11 0:47am
v2

You need to make sure your page is using percentages (100%) instead of layout pixels. That is a safe way of ensuring your page resizes correctly.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 25-Apr-11 11:19am    
You answer is going in right direction (and not what OP probably wants, but your suggestion is better), my 5.
I have a more general idea though; and I'm pretty sure it's the best approach.
Please see my answer.
--SA
Abhinav S 25-Apr-11 11:31am    
Thanks SA.
Monjurul Habib 25-Apr-11 18:26pm    
nice answer.my 5.
Abhinav S 25-Apr-11 22:42pm    
Thanks.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 25-Apr-11 11:20am    
Interesting and useful references, my 5.
As to a practical approach, I the design based on the knowledge of resolution is wrong.
Please see my answer.
--SA
thatraja 25-Apr-11 11:26am    
/*As to a practical approach, I the design based on the knowledge of resolution is wrong.*/
Agree. that's why I gave him "Liquid layouts"(% approach) as 1st link. Other js related links are just for reference.
BTW Thanks SA. Hope you have enjoyed the holidays :)
Sergey Alexandrovich Kryukov 25-Apr-11 11:39am    
I really did, thank you.
--SA
Monjurul Habib 25-Apr-11 18:26pm    
nice links.my5
Prasanta_Prince 26-Apr-11 3:28am    
Good one 5 for that.
I would say that generating UI based on screen resolution is a very difficult approach which will get you in trouble. It is bad for every kind of UI development and additionally goes together with ASP.NET model very poorly. This is not who ASP.NET and Web applications normally work, so that would be a big abuse of Web-based technology.

The write approach would be using HTML page design if a way highly tolerant to the screen pixel dimensions. This is quite possible and in fact more feasible alternative.

—SA
 
Share this answer
 
Comments
Abhinav S 25-Apr-11 11:32am    
Good suggestion for the OP. 5.
Sergey Alexandrovich Kryukov 25-Apr-11 11:38am    
Thank you, Abhinav.
--SA
Monjurul Habib 25-Apr-11 18:26pm    
nice answer.my5
Sergey Alexandrovich Kryukov 25-Apr-11 18:40pm    
Thank you, Monjurul.
--SA
XML
string whatever = "add your javascript";

Page.RegisterStartupScript("myScript", "<script language=JavaScript>hi('" + whatever + "');</script>");

I hope that is what you are looking for and hope it helps!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900