Péter
Péter

Reputation: 2181

ASP.Net using multiple form tag and post them to another page

I don't know it's even possible but I try to achieve to post data from one page to another using the second form.
The problem is I need a form tag for the user interface containing callback panels etc. I want to put a second form with some hidden-field:

<form id="postForm" method="post" action="target.aspx">
    <input type="hidden" id="id" />
</form>

I submit the form from javascript with jquery:

$("#id").val(id);
$("#postForm").submit();

Is there a way access the value of the hidden field on the target page?

Upvotes: 0

Views: 959

Answers (1)

LukeH
LukeH

Reputation: 269518

You should give the hidden field a name attribute:

<input type="hidden" id="id" name="id" />

You'll then be able to use Request.Form in your target page to access the posted data:

string postedId = Request.Form["id"];

Upvotes: 1

Related Questions