Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read form values from previous page

Status
Not open for further replies.

ciupaz

Programmer
Jun 15, 2009
6
Hi all,
in a .aspx page I have a button with

onclick="this.form.action='Test2.aspx'"

and several input fields,

Surname: <br />
<input type="text" id="cognome" name="cognome" /><br />
City: <br />
<input type="text" id="city" name="city" />
<p />

How can I read the values from the previous page?

Thanks in advance.

Luis
 
pull the values from the From dictionary.
Code:
string cognome = Request.Form["cognome"];
string city = Request.Form["city"];

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
YOu can do it the way you are doing however that is classic ASP programming. If you are using the 2.0 framwork or greater then look into CrossPagePosting:

set the PostbackUrl property of a button to set the action. Then on the page you are posting to, you get the PreviousPage property and controls from it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top