HTML Helper

Extensions provided for the HtmlHelper class.

Setup

To use the extensions within your views the JL.Web.Forms.Html namespace must be added into the pages.namespaces section of your Web.config i.e.:
<namespaces>
	<add namespace="System.Web.Mvc"/>
	<add namespace="System.Web.Mvc.Ajax"/>
	<add namespace="System.Web.Mvc.Html"/>
	<add namespace="System.Web.Routing"/>
	<add namespace="System.Linq"/>
	<add namespace="System.Collections.Generic"/>
	<add namespace="JL.Web.Forms.Html"/>
</namespaces>

Methods

BeginMvcForm Method

This method works very similar to the default BeginForm method except the first parameter will always take a JL.Web.Forms.IForm object. The encoding type will automatically be set to the correct type for the supplied form.

Just like the default method wrapping the call in a using statement will output a closing tag for your form.

Example:
<% using (Html.BeginMvcForm(Model)) { %>
	<table>
		<%=Model %>
		<tr>
			<td></td>
			<td><input type="submit" value="Submit" /></td>
		</tr>
	</table>
<% } %>

Last edited Jan 17, 2010 at 9:24 PM by timsavage, version 5

Comments

No comments yet.