7

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

1 Answer 1

4

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;
        }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.