Finish confirm page
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user