Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Oct 15, 2009 07:58 AM by matrixvibe
Oct 14, 2009 08:03 AM|LINK
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?
Oct 14, 2009 01:17 PM|LINK
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"]%>"/>
Keep a outer <div> immediately after <form> tag and set width and height of same
<form id="form1" runat="server">
<div id="contentwrap" runat="server">
<!-- ALL YOUR HTML LAYOUT GOES HERE -->
Oct 14, 2009 01:47 PM|LINK
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! ;)
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">
Oct 15, 2009 07:58 AM|LINK
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.