Blogs

News

Email Subscriptions

Mehul Harry's DevExpress Blog

ASP.NET MVC - Code Usability Improvement (available now in v2011.1)

     

Available now in the DXperience v2011.1 release, we've introduced a useful improvement for working with the DevExpress ASP.NET MVC Extensions that will help improve code usability.

Add Method For Collections

We're adding a useful new overload for our collections' Add methods. So the fluent HTML code in our MVC Extensions that looked like this:

var column = settings.Columns.Add("Total");
column.UnboundType = DevExpress.Data.UnboundColumnType.Decimal;
column.PropertiesEdit.DisplayFormatString = "c";

Will now look like this with v2011 volume 1 release:

settings.Columns.Add(column => { 
    column.FieldName = "Total";
    column.UnboundType = DevExpress.Data.UnboundColumnType.Decimal;
    column.PropertiesEdit.DisplayFormatString = "c";
})

Benefits

The benefit for you with the new Add method is that it avoids the var structure and makes your code more readable!

Thanks to a DevExpress customer who asked me during a recent webinar about using more lambda expressions in our MVC extensions.

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

Build Your Best - Without Limits or Compromise

Try the DevExpress ASP.NET MVC Extensions online now: http://mvc.devexpress.com

Read the latest news about DevExpress ASP.NET MVC Extensions

Download a free and fully-functional version of DXperience now: http://www.devexpress.com/Downloads/NET/

Follow MehulHarry on Twitter

Published Apr 15 2011, 08:15 AM by Mehul Harry (DevExpress)
Technorati tags: Features, v2011.1, ASP.NET MVC
Bookmark and Share

Comments

 

Graeme Ross said:

Great improvement, any chance this will be included for settings/properties.

settings.SettingsPager(sp => {

    sp.AllButton.Visible = true;

    sp.AlwaysShowPager = true;

    sp.Position = PagerPosition.TopAndBottom;

});

April 15, 2011 6:58 PM
 

Mehul Harry (DevExpress) said:

Graeme,

Thanks! And it's possible so we'll consider it for a future release.

April 18, 2011 2:20 PM

About Mehul Harry (DevExpress)

Mehul Harry is an ASP.NET technical evangelist at Developer Express. You can reach him directly at mharry@DevExpress.com. You can also follow him on Twitter: http://twitter.com/mehulharry
More from DevExpress
Live Chat
Have a pre-sales question?
Need assistance with your evaluation?
We are here to help.
Chat is one of the many ways you can contact members of the DevExpress Team. We are available Monday-Friday between 8:30am and 5:00pm Pacific Time.
If you need additional product information, require pre-sales assistance, or want help with your order, write to us at info@devexpress.com or call us at
+1 (818) 844-3383.