Now Available - ASP.NET MVC 3 Razor Demos Online!

ASP.NET Team Blog
25 July 2011

DevExpress_MVCGood 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

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:

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:

Here's a preview of the Razor demo code:

@using System.Text.RegularExpressions

    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 =>
                "<span id=\"lblLoading\">&nbsp;</span>"
        settings.SetEmptyDataRowTemplateContent(c =>
                "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=\"{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=\"{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;

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:

Read the latest news about DevExpress ASP.NET MVC Extensions:

Download a free and fully-functional version of DXperience now:

Follow MehulHarry on Twitter

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.