7
Cách tốt nhất để mở rộng Hộp văn bản trợ giúp Html là gì? Có cách nào để tái sử dụng thực hiện defautl?Asp.Net MVC Html Helper Extension
Cách tốt nhất để mở rộng Hộp văn bản trợ giúp Html là gì? Có cách nào để tái sử dụng thực hiện defautl?Asp.Net MVC Html Helper Extension
Bạn có thể tạo các phương pháp mở rộng của bạn (trong một lớp tĩnh), ví dụ:
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;
}