Reputation: 313
I have attempted to apply the accepted answer to this question How to access html form input from asp.net code behind
and other similar questions.
I have the following HTML input, that I am using to display a datepicker:
FROM:<input type="text" runat="server" name="popupDatepickerFrom" id="popupDatepickerFrom">
and this code to then retrieve the value:
string myStringFromTheInput = popupDatepickerFrom.Value;
Response.Write(myStringFromTheInput);
Response.End();
But this does not return anything. What am I doing wrong?
Upvotes: 0
Views: 738
Reputation: 717
Make sure that your input is within a form element, as shown on this page:
How to access html form input from asp.net code behind
Upvotes: 2
Reputation: 4221
You should be able to access the popupDatepickerfrom data like this:
string myStringFromTheInput = String.Format("{0}", Request.Form["popupDatepickerFrom"]);
Response.Write(myStringFromTheInput);
Response.End();
Upvotes: 1
Reputation: 1068
Try
string myStringFromTheInput = Request.Form["popupDatepickerFrom"];
Upvotes: 1