c# - How to extend TextAreaFor in MVC -
i know how extend textboxfor :
public static mvchtmlstring textboxfor<tmodel, tvalue>(this htmlhelper<tmodel> htmlhelper, expression<func<tmodel, tvalue>> expression, object htmlattributes) { mvchtmlstring html = default(mvchtmlstring); routevaluedictionary routevalues = new routevaluedictionary(htmlattributes); html = system.web.mvc.html.inputextensions.textboxfor(htmlhelper, expression, routevalues); return html; }
i want same textareafor unfortunately system.web.mvc.html.inputextensions dose not contain textareafor method. how can solve ?
see doc, it's in textareaextensions
static class
return system.web.mvc.html.textareaextensions.textareafor(htmlhelper, expression, routevalues);
or just
return htmlhelper.textareafor(expression, routevalues);
by way, third argument (as in textboxfor) idictionary<string, object> htmlattributes
, nothing routevalues.
it's working because routevaluedictionary
implements idictionary<string, object>
, arguments confusing.
Comments
Post a Comment