TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Peter Cottle
NA
14
6.7k
Getting hidden field value on next page
Feb 18 2015 3:56 AM
Hi
I have a hidden value field on a page. On submit I post to a different page. On the page I've posted to I do a Request.Form but I do not get the value just a null value.
This is the initial page
<div id="booking_content_wrapper">
<form id="mainForm" name="mainForm" runat="server" action="Cancellation.aspx">
<h2>Paid Bookings</h2>
<table cellpadding="0" cellspacing="0" border="0" id="booking_table">
<tr>
<th width="110">Enquiry No.</th>
<th width="250">Establishment</th>
<th width="110">Arrival Date</th>
<th width="20">Confirmed</th>
<th>Action</th>
</tr>
<asp:Literal ID="PaidBookingsResults" runat="server"></asp:Literal>
</table>
<asp:HiddenField runat="server" ID="ResID" EnableViewState="true" />
</form>
</div>
<script>
function ViewCancellation(sResID) {
document.getElementById("<%=ResID.ClientID%>").value = sResID;
document.getElementById("mainForm").submit();
}
</script>
The javascript ViewCancellation function is set to a hyperlink in the code behind. The function will have a value like this,<a href=\"#\" onclick=\"ViewCancellation(54666);return false;\">cancel</a>
On the page I'm posting to I'm doing this
string sResID = "";
protected void Page_Load(object sender, EventArgs e)
{
HttpContext context = HttpContext.Current;
sResID = context.Request.Form["ResID"] != null ? context.Request.Form["ResID"] : "";
sResID = Regex.Replace(sResID, "/[^A-Z]\\d-/g", "");
context.Response.Write(sResID);
}
sResID gets no value because context.Request.Form["ResID"] is null. How can I get the value to this page. I've enabledviewstate
Reply
Answers (
3
)
How Do I Use Sms Service For All Employee
scanning image in windows phone 8.1