ASP.NET MVC - Form Layout - Code Usability Improvement (Shipping in v15.1)

ASP.NET Team Blog
18 June 2015

Available now in the DXperience v15.1 release, we've introduced a useful improvement for working with the DevExpress MVC Form Layout extension.

Now it's much easier to configure a nested extension.

Form Layout - MVC

The DevExpress MVC Form Layout extension is great because it helps you to create beautiful forms.

The Problem

The Form Layout extension is a container control where it embeds other controls within it.

The problem is when you want to access one of these nested/embedded controls. To do this, previously, you would have to write some code like this:

settings.Items.Add(i => {
   i.NestedExtensionType = FormLayoutNestedExtensionItemType.ComboBox;
   var cbSettings = (ComboBoxSettings)itemSettings.NestedExtensionSettings;
   cbSettings.Properties.ValueType = typeof(int);

Solution - Lambda Expression

Now with v15.1, it is simple because you can configure it using a lambda expression:

settings.Items.Add(i => {
  i.NestedExtension().ComboBox(s => {
     s.Properties.ValueType = typeof(int);

The new approach benefits you because you do not need have reference type or a separate variable for settings and properties.

And there's less code to write which makes the code more readable!

Demo sample

Check out the an example of this code here:

MVC Form Layout Demo

What do you think of this code improvement? Drop me a line below, thanks!

Your Next Great .NET App Starts Here

Year after year, .NET developers such as yourself consistently vote DevExpress products #1.

Experience the DevExpress difference for yourself and download a free 30-day trial of all our products today: (free support is included during your evaluation).

Showcase Your Apps on

Highlight your business app and share your development experiences with the DevExpress community. To include your app in our upcoming App Showcase, please forward an application screenshot to and tell us which DevExpress products you currently use within your organization.
No Comments

Please login or register to post comments.