Download ASP.NET MVC XForm

ASP.NET MVC XForms is a simple, strongly-typed, extensible UI framework based on the W3C XForms spec. It provides a base set of form controls that allow updating of any complex model object, even complex nested lists. It uses clean, semantic HTML and a fluent, lamba-based API.

XForms spec: "The group element is used as a container for defining a hierarchy of form controls. Groups can be nested to create complex hierarchies."

This means that Group essentially gives you a "context" to work from. An example could be an address of a person:

<% form.Group(p => p.Address).Template(address => { %>
<%= address.Input(a => a.Address1).Label("Address") %>
<%= address.Input(a => a.Address2).Label("") %>
<%= address.Select1(a => Country, ViewData.Model.Countries, c => c.ID,




c => c.Name) %>
<% }); %>



Which would generate the following HTML:




<div id="Address" class="xf group">
<div class="xf input text">
<label for="Address_Address1">Address</label>
<input id="Address_Address1" type="text" value=""


name="Address_Address1"/>
</div>
<div class="xf input text">
<input id="Address_Address2" type="text" value=""


name="Address_Address2"/>
</div>
<div class="xf select1">
<label for="Address_Country_ID">Country</label>
<select id="Address_Country_ID" name="Address_Country_ID">
<option value="1" selected="selected">UK</option>
<option value="2">USA</option>
<option value="3">France</option>
<option value="4">Italy</option>
</select>
</div>
</div>


Download : codeplex.com


Technorati Tags: ,,,



Related Posts by Categories



Widget by Hoctro

Enter your email address:

Delivered by FeedBurner

Followers



Source Code

Tips