 |
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
|
|
|
|
|

January 4th, 2012, 12:39 PM
|
|
Authorized User
|
|
Join Date: Mar 2011
Posts: 74
Thanks: 21
Thanked 2 Times in 2 Posts
|
|
How do I Insert Hidden Data Form Fields?
I would like to submit a form with hidden data fields.
In ColdFusion I would use the following code within my <form></form> tags:
<input type="hidden" name="Week" value="1">
How do I do this with WebMatrix/Razor?
|
|

January 4th, 2012, 04:35 PM
|
|
Wrox Author
|
|
Join Date: Dec 2011
Posts: 57
Thanks: 1
Thanked 19 Times in 19 Posts
|
|
You would do it in exactly the same way in ASP.NET Web Pages. What you have is standard HTML which will work in exactly the same way with any server-side technology.
You could also use a Razor helper:
Code:
@Html.Hidden("Week", 1)
See more on the helpers here: http://www.mikesdotnetting.com/Artic...azor-Web-Pages
|
|
The Following User Says Thank You to Mike Brind For This Useful Post:
|
|
|

January 4th, 2012, 04:36 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Since these are plain HTML elements, you can do the exact same thing in WebMatrix....
Alternatively, you can use the Html.Hidden helper: http://www.mikesdotnetting.com/Artic...azor-Web-Pages
Cheers,
Imar
|
|

January 4th, 2012, 04:36 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hahaha, great minds think alike. Nice timing, and great answer.... ;-)
Imar
|
|

January 4th, 2012, 04:58 PM
|
|
Wrox Author
|
|
Join Date: Dec 2011
Posts: 57
Thanks: 1
Thanked 19 Times in 19 Posts
|
|
Just as well that we agreed with eachother ;o)
|
|

January 5th, 2012, 12:45 PM
|
|
Authorized User
|
|
Join Date: Mar 2011
Posts: 74
Thanks: 21
Thanked 2 Times in 2 Posts
|
|
Quote:
Originally Posted by Mike Brind
You would do it in exactly the same way in ASP.NET Web Pages. What you have is standard HTML which will work in exactly the same way with any server-side technology.
You could also use a Razor helper:
Code:
@Html.Hidden("Week", 1)
See more on the helpers here: http://www.mikesdotnetting.com/Artic...azor-Web-Pages
|
Thanks Mike for the reply and excellent help, providing a spot on code example! Works perfectly! WebMatrix, Razor and this book, is a great starting place for ColdFusion developers to make the transition to ASP.Net
|
|
 |