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 January 4th, 2012, 12:39 PM
Authorized User
 
Join Date: Mar 2011
Posts: 74
Thanks: 21
Thanked 2 Times in 2 Posts
Default 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?
 
Old January 4th, 2012, 04:35 PM
Wrox Author
 
Join Date: Dec 2011
Posts: 57
Thanks: 1
Thanked 19 Times in 19 Posts
Default

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:
Imar (January 4th, 2012)
 
Old January 4th, 2012, 04:36 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 4th, 2012, 04:36 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hahaha, great minds think alike. Nice timing, and great answer.... ;-)

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 4th, 2012, 04:58 PM
Wrox Author
 
Join Date: Dec 2011
Posts: 57
Thanks: 1
Thanked 19 Times in 19 Posts
Default

Just as well that we agreed with eachother ;o)
 
Old January 5th, 2012, 12:45 PM
Authorized User
 
Join Date: Mar 2011
Posts: 74
Thanks: 21
Thanked 2 Times in 2 Posts
Default

Quote:
Originally Posted by Mike Brind View Post
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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing textboxes to hidden fields - HELP!!! jroxit ASP.NET 1.0 and 1.1 Basics 4 February 10th, 2006 07:46 PM
hidden input fields and Mozilla panos CSS Cascading Style Sheets 1 February 3rd, 2006 05:45 PM
Creating hidden fields SmoothAl BOOK: Beginning ASP 3.0 0 February 6th, 2005 01:44 AM
empty fields not hidden anymore (php/mySQL) jasmin Beginning PHP 1 January 17th, 2005 12:42 PM
CH3, pg 96 Hidden Form Fields wadesmart BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 19 October 28th, 2003 03:18 PM





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