I did this custom helper:
public static System.Web.Mvc.MvcHtmlString RzTextBoxForCNPJ<TModel, TValue>(this System.Web.Mvc.HtmlHelper<TModel> html,
System.Linq.Expressions.Expression<System.Func<TModel, TValue>> expression)
{
System.Collections.Generic.Dictionary<string, object> htmlAttributes = new System.Collections.Generic.Dictionary<string, object>();
htmlAttributes.Add("class", "form-control cnpj");
return (html.TextBoxFor(expression, htmlAttributes));
}
To avoid need to add class attributes to field of specific type.
But. When using this helper:
@RzHelpers.RzTextBoxForCNPJ(model => model.Cnpj)
I received this error:
CS7036: There is no argument given that corresponds to the required formal parameter 'expression' of 'RzHelpers.RzTextBoxForCNPJ(HtmlHelper, Expression>)'
As if I was passed wrong type or number of parameters.
It is not my first helper and never must pass the first parameter, only from the 2nd onwards.
What am I forgotting?