Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950
This is the forum to discuss the Wrox book ASP.NET MVC Website Programming Problem Design Solution by Nicholas Berardi, Al Katawazi, and Marco Bellinaso; ISBN: 9780470410950
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950 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
 
 
Thread Tools Display Modes
  #11 (permalink)  
Old May 28th, 2010, 10:03 PM
Registered User
 
Join Date: May 2010
Location: Douglassville, PA
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via AIM to fourpastmidnight Send a message via MSN to fourpastmidnight Send a message via Yahoo to fourpastmidnight
Default Html.BeginForm

Well, I must say I agree with Nick that it is good to know the "magic" behind ASP.NET MVC. The "magic" is, there is none! Anyway, the HTML in the book exactly matches what would be produced by the Html.BeginForm(...) method.

Now, if you know the HTML produced by a method, and it's acceptable for your site design, I say go ahead and use it. Personally, I prefer the Html.BeginForm method, but that's only because I know what it does.

And by the way, you can wrap the call to that method in a using(...) { ... } block and then you never have to call Html.EndForm(...).

Example:

Code:
<% using (Html.BeginForm("MyAction", "MyController", FormMethod.Post, new { @class = "my-css-class" }))
  {
%>

  <!-- Your HTML and in-line ASP.NET code here. -->
<% } %>
Coming to the end of the 'using' block will automatically call Html.EndForm() so you don't have to.

As Nick said, the above will simply get translated into the following HTML:

Code:
<form action="/MyController/MyAction" method="Post" class="my-css-class">
  <!-- Your HTML and in-line ASP.NET code here. -->
</form>
 


Thread Tools
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
form helper blackhorse66 BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8 0 June 24th, 2009 03:01 PM
Need of Helper and Global classes rajanikrishna BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 December 22nd, 2008 06:14 PM
help with Muenchian method grouping and html table mickhughes XSLT 3 May 1st, 2008 07:24 AM
onChange method of <select> in Html not working pushpa Classic ASP Databases 4 January 23rd, 2007 11:20 AM
'helper' function? jtyson ASP.NET 1.0 and 1.1 Basics 1 June 29th, 2004 09:12 AM



All times are GMT -4. The time now is 05:19 AM.


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