Html Helper Extension Asp.Net MVC

What is the best way to extend Html Helper TextboxFor? Is there a way to reuse the defautl implementation?

+7
source share
1 answer

You can create your extension methods (in a static class), for example:

public static MvcHtmlString MyTextBoxFor<TModel, TProperty>(this HtmlHelper<TModel> helper, Expression<Func<TModel, TProperty>> expression) { // call original method MvcHtmlString result = InputExtensions.TextBoxFor(helper, expression); // do modification to result return result; } 
+4
source

All Articles