David,
I can think of two things that may be happening.
The first is that there won't be any value in either of those fields until a
postback has occurred. The first time your code runs the page hasn't
displayed on the client and the javascript hasn't filled those fields.
The second (if the problem isn't the first) is that setting the controls as
runat="Server" may be interfering with the process. If you're going to use
Request.Form to get the values the controls don't have to be .Net controls.
You would only use runat="Server" if you want to reference the hidden inputs
as .Net server side controls. To do that you should declare them on your
page something like:
Protected WithEvents resW As System.Web.Html Controls.HtmlGe nericControl
(I typed that from memory, so double check the system declaration...)
But from the looks of things I would just remove the runat="Server" and then
do the Request.Form on postback only.
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"DavidS" <Da****@discuss ions.microsoft. com> wrote in message
news:9C******** *************** ***********@mic rosoft.com...
I've have the following in HTML code...
<script language="javas cript">
document.getEle mentById('resW' ) = window.screen.w idth;
document.getEle mentById('resH' ) = window.screen.h eight;
</script>
<input type=hidden name=resW id=resW runat=server>
<input type=hidden name=resH id=resH runat=server>
How can I access the values in ASP.NET (VB) code behind? I keep getting
null values when I use Request.Form("r esW") or resW.Value?
What am I missing?
"Eliyahu Goldin" wrote:
You need to pass the values from client to server side. The standard way
is
to use hidden input controls:
<input type=hidden runat=server id=inhResW>
Eliyahu
"DavidS" <Da****@discuss ions.microsoft. com> wrote in message
news:BC******** *************** ***********@mic rosoft.com... > Have resW=screen.wid th; resH=screen.hei ght in javascript. How can I
> read
> these values in ASP.NET source code - Page_Load function of code
> behind?
>
> Any suggestions?