Quantcast
Channel: Trailmax Tech » html
Viewing all articles
Browse latest Browse all 3

Creating custom Html Helper in MVC3

$
0
0
Creating custom attribute is pretty simple really, just follow the example. You need to return MvcHtmlString – that is string with your html to be displayed on a page – this will not be escaped. public static MvcHtmlString DisplayWithNameFor<TModel, TProperty>( this HtmlHelper<TModel> htmlHelper,Expression<Func<TModel, TProperty>> expression) { ModelMetadata metaData = ModelMetadata.FromLambdaExpression(expression, htmlHelper.ViewData); if (metaData.Model == null)… Continue reading

Viewing all articles
Browse latest Browse all 3

Trending Articles