you have to use % type width declaration in yr html table or div tags.. so tht it will be adjusted automatically..
i dont think so tht by using .net u can do this.. this is designing stuff ..u can adjust screen resolution & frame by programming bt not the designing stuff..it would be very tedious task..
arnoldzw
0 Points
3 Posts
Adjust mobile screensize automaticly to form
Oct 14, 2009 08:03 AM|LINK
Hi guys,
First of al, Sorry for my bad englisch!
I`m creating a simple mobile website in ASP.NET and i want to adjust the screensize automaticly to the form.
with the mobile.browser file i get the screen pixels size from the different mobile devices with are defined in the mobile.browser file.
"ScreenWidth = Request.Browser.ScreenPixelsWidth"
"ScreenHeight = Request.Browser.ScreenPixelsHeight"
This works, and i get the screen sizes back. (tried it with an HTC and an iPhone)
How can i adjust this ScreenWidth en ScreenHeight to the form, so it automaticly fits to any mobile device? (also at an iPhone)
I have tried it with: form1.Style.Value = "width: " & ScreenWidth & "px; height: " & ScreenHeight & "px"
But this isn`t working, who can advice me?
Thanks!!
form mobile automaticly adjust screensize
matrixvibe
Participant
943 Points
173 Posts
Re: Adjust mobile screensize automaticly to form
Oct 14, 2009 01:17 PM|LINK
Hello
Please try following
1) Solution1 :
Will work for phones that support View Port
Add below tag under <head>
<meta name="viewport" content="width=<%= Request.Browser["ScreenPixelsWidth"] %>, height=<%=Request.Browser["ScreenPixelsHeight"]%>"/>
2) Solution2:
Keep a outer <div> immediately after <form> tag and set width and height of same
e.g.
<body>
<form id="form1" runat="server">
<div id="contentwrap" runat="server">
<!-- ALL YOUR HTML LAYOUT GOES HERE -->
</div>
</form>
</body>
arnoldzw
0 Points
3 Posts
Re: Adjust mobile screensize automaticly to form
Oct 14, 2009 01:47 PM|LINK
Hi,
The answer of you is in HTML code, i want to build the site fully in .NET.
Is there also another option, i`m trying now for 3 days, i`m desparate haha! ;)
sandy060583
Star
8728 Points
1626 Posts
Re: Adjust mobile screensize automaticly to form
Oct 14, 2009 02:18 PM|LINK
you have to use % type width declaration in yr html table or div tags.. so tht it will be adjusted automatically..
i dont think so tht by using .net u can do this.. this is designing stuff ..u can adjust screen resolution & frame by programming bt not the designing stuff..it would be very tedious task..
<input id="gwProxy" type="hidden"><input onclick="jsCall();" id="jsProxy" type="hidden">
<div id="refHTML"></div>Ramani Sandeep (My Blog)
(MCTS, MCC-2011)
matrixvibe
Participant
943 Points
173 Posts
Re: Adjust mobile screensize automaticly to form
Oct 15, 2009 07:58 AM|LINK
Hello
I agree you want to do in .NET , but designing is always in HTML so just put your .NET controls within the div and see how it works.
Please go ahead with this it will solve your purpose of screen size.
Thanks