Simple question. I have the following hidden input field on my ASP.NET page:
<form id="userform" method="post" action="RankingPage.aspx">
<input type="hidden" id="email" />
<input type="hidden" id="name" />
</form>
I’m trying to get the data from the field (in my code behind) like this:
protected void Page_Load(object sender, EventArgs e)
{
string name = Request.Form["name"].ToString();
}
It’s returning a null reference (which I’m assuming means it couldn’t find the field). Am I doing this wrong?
oh geee, i was struggeling with this myself today.
I wanted to use the hidden html field to store info inbetween partial postbacks from my update panels.
I didn’t want to use the ‘runat =”server” ‘ on my hidden field as this then screws the ID (because i’m using masterpages).
the moment i changed mine from
to
i was able to call the read the value from codebehind (on postback)
cut a long story short.. you need to add the name property as well, otherwise it won’t work.