Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > BOOK: Beginning ASP.NET Web Pages with WebMatrix
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 4th, 2012, 12:39 PM
Authorized User
Points: 313, Level: 6
Points: 313, Level: 6 Points: 313, Level: 6 Points: 313, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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?
Reply With Quote
  #2 (permalink)  
Old January 4th, 2012, 04:35 PM
Wrox Author
Points: 412, Level: 7
Points: 412, Level: 7 Points: 412, Level: 7 Points: 412, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Reply With Quote
The Following User Says Thank You to Mike Brind For This Useful Post:
Imar (January 4th, 2012)
  #3 (permalink)  
Old January 4th, 2012, 04:36 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #4 (permalink)  
Old January 4th, 2012, 04:36 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #5 (permalink)  
Old January 4th, 2012, 04:58 PM
Wrox Author
Points: 412, Level: 7
Points: 412, Level: 7 Points: 412, Level: 7 Points: 412, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 57
Thanks: 1
Thanked 19 Times in 19 Posts
Default

Just as well that we agreed with eachother ;o)
Reply With Quote
  #6 (permalink)  
Old January 5th, 2012, 12:45 PM
Authorized User
Points: 313, Level: 6
Points: 313, Level: 6 Points: 313, Level: 6 Points: 313, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:18 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.