Finish confirm page

This commit is contained in:
2012-12-16 15:06:57 -05:00
parent 7f7ae6d3c2
commit 5be12d783b
8 changed files with 120 additions and 79 deletions
+11
View File
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Web.Mvc;
@@ -170,5 +171,15 @@ namespace MileageTraker.Web.Utility
{
return MvcHtmlString.Create(f + s);
}
public static MvcHtmlString DisplayNameFor<TModel, TProperty>(
this HtmlHelper<TModel> htmlHelper,
Expression<Func<TModel, TProperty>> expression
)
{
var metaData = ModelMetadata.FromLambdaExpression(expression, htmlHelper.ViewData);
var value = metaData.DisplayName ?? (metaData.PropertyName ?? ExpressionHelper.GetExpressionText(expression));
return MvcHtmlString.Create(value);
}
}
}