Wrox Programmer Forums
|
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 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 May 28th, 2010, 09:03 PM
Registered User
 
Join Date: May 2010
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>





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 02: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 06: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 08:12 AM





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