Now Available - ASP.NET MVC 3 Razor Demos Online!
Good news for you ASP.NET MVC 3 Razor View Engine fans.
We've updated all of our online demos to the Razor View Engine code!
Check our the updated code online at http://mvc.devexpress.com
Available in v2011 vol 1.6
A local version of our MVC demos is available now in the DXperience v2011 volume 1.6 minor release.
Download it here: http://devexpress.com/ClientCenter/Downloads/
How To Use In MVC 3
The DevExpress ASP.NET MVC Extensions are fully compatible with ASP.NET MVC 3 Razor view engine now. Check out these resources to learn more about using:
- Great help topic: Using in Razor Views
- Original announcement: ASP.NET MVC 3: Razor View Engine Support Added!
- Webinar: ASP.NET MVC 3 w/DevExpress Extensions
- Blog post: ASP.NET MVC 3 Project Templates - Razor Support and Empty Templates
- Online demos: http://mvc.devexpress.com
Here's a preview of the Razor demo code:
@using System.Text.RegularExpressions @Html.DevExpress().GridView( settings => { settings.Name = "gvDataBinding"; settings.CallbackRouteValues = new { Controller = "GridView", Action = "DataBindingPartial" }; settings.Width = Unit.Percentage(100); settings.SettingsText.Title = "DevExpress on Twitter"; settings.Settings.ShowTitlePanel = true; settings.Settings.ShowStatusBar = GridViewStatusBarMode.Visible; settings.SettingsPager.Mode = GridViewPagerMode.ShowAllRecords; settings.SettingsPager.AllButton.Text = "All"; settings.SettingsPager.NextPageButton.Text = "Next >"; settings.SettingsPager.PrevPageButton.Text = "< Prev"; settings.SetStatusBarTemplateContent(c => { ViewContext.Writer.Write( "<span id=\"lblLoading\"> </span>" ); }); settings.SetEmptyDataRowTemplateContent(c => { ViewContext.Writer.Write( "Sorry, the twitter server is not available this time." ); }); settings.CustomColumnDisplayText = (sender, e) => { if(e.Column.FieldName != "Text") return; string displayText = (e.Value != null) ? e.Value.ToString() : ""; TweetsDemoReplaceItem[] replaceItems = new TweetsDemoReplaceItem[] { new TweetsDemoReplaceItem{ RegEx = new Regex("http://[^\\s()]+"), ReplaceDelegate = (text, match) => { return text.Replace(match.Value, string.Format("<a href=\"{0}\">{0}</a>", HttpUtility.HtmlEncode(match.Groups[0].Value))); } }, new TweetsDemoReplaceItem{ RegEx = new Regex("(^|[^\\w])@(\\w+)"), ReplaceDelegate = (text, match) => { return text.Replace(match.Value, string.Format("{0}<a href=\"http://twitter.com/{1}\">@{1}</a>", match.Groups[1], HttpUtility.HtmlEncode(match.Groups[2].Value))); } }, new TweetsDemoReplaceItem{ RegEx = new Regex("(^|[^\\w/&?])(#\\w+)"), ReplaceDelegate = (text, match) => { return text.Replace(match.Value, string.Format("{0}<a href=\"http://twitter.com/search?q={1}\">{2}</a>", match.Groups[1], Url.Encode(match.Groups[2].Value), HttpUtility.HtmlEncode(match.Groups[2].Value))); } } }; foreach(TweetsDemoReplaceItem replaceItem in replaceItems) { MatchCollection matches = replaceItem.RegEx.Matches(displayText); foreach(Match match in matches) displayText = replaceItem.ReplaceDelegate(displayText, match); } e.DisplayText = displayText; }; }).Bind(Model).GetHtml()
This the razor code for the partial view of our MVC GridView's Twitter Databinding Demo.
Available Now!
Our new MVC 3 Razor demos of our ASP.NET MVC Extensions are available now.
Download the minor release of DXperience v2011 vol 1.6 and see for yourself.
Are you looking forward to the new MVC 3 Razor demos? 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: http://dxpr.es/ov1tQa
Download a free and fully-functional version of DXperience now: http://www.devexpress.com/Downloads/NET/