Wrox Programmer Forums
|
BOOK: Beginning ASP.NET Web Pages with WebMatrix
This is the forum to discuss the Wrox book Beginning ASP.NET Web Pages with WebMatrix by Mike Brind, Imar Spaanjaars ; ISBN: 978-1-1180-5048-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET Web Pages with WebMatrix section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 17th, 2012, 06:03 PM
Registered User
 
Join Date: Sep 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default Webmatrix - Passing values between pages

Page one collects an email address via a form object. Page two wants to display the email on a thank you note.

Would prefer not to see the web address in the URL.

page one
@var emailAddress = request.form["youremail'];

<form action="" method="post">
input type="text" name="youremail" /><br />
input type="submit" value="click me" />
</form>

page two
<p> Thanks. I sent your request to: ? </p>
<div> Thanks. I sent your request to:@ ? </div>

Thanks
Dallas in Maryland
 
Old September 18th, 2012, 12:53 AM
Wrox Author
 
Join Date: Dec 2011
Posts: 57
Thanks: 1
Thanked 19 Times in 19 Posts
Default

You can change the form's action to page2.cshtml:

<form action="~/page2.cshtml" method="post">
<input type="text" name="youremail" /><br />
<input type="submit" value="click me" />
</form>

In page2:

<div> Thanks. I sent your request to:@Request["youremail"] </div>

Or, if you want to post the form to itself to aid validation, you can transfer values using cookies or session. More details can be found here:http://www.mikesdotnetting.com/Artic....NET-Web-Pages





Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Vaules between Pages testsubject HTML Code Clinic 0 August 28th, 2009 04:29 AM
Passing values between Asp to Asp pages. jayaraj ASP.NET 1.0 and 1.1 Professional 3 May 23rd, 2004 06:53 AM
passing data between pages johnhardy BOOK: Beginning ASP 3.0 1 October 18th, 2003 04:29 AM
Passing parameters between pages burdickdave ASP.NET 1.x and 2.0 Application Design 3 July 7th, 2003 02:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.