1 namespace System.Web.Mvc.Html { 2 using System; 3 using System.Diagnostics.CodeAnalysis; 4 using System.Linq.Expressions; 5 using System.Web.UI.WebControls; 6 7 public static class EditorExtensions { Editor(this HtmlHelper html, string expression)8 public static MvcHtmlString Editor(this HtmlHelper html, string expression) { 9 return TemplateHelpers.Template(html, expression, null /* templateName */, null /* htmlFieldName */, DataBoundControlMode.Edit, null /* additionalViewData */); 10 } 11 Editor(this HtmlHelper html, string expression, object additionalViewData)12 public static MvcHtmlString Editor(this HtmlHelper html, string expression, object additionalViewData) { 13 return TemplateHelpers.Template(html, expression, null /* templateName */, null /* htmlFieldName */, DataBoundControlMode.Edit, additionalViewData); 14 } 15 Editor(this HtmlHelper html, string expression, string templateName)16 public static MvcHtmlString Editor(this HtmlHelper html, string expression, string templateName) { 17 return TemplateHelpers.Template(html, expression, templateName, null /* htmlFieldName */, DataBoundControlMode.Edit, null /* additionalViewData */); 18 } 19 Editor(this HtmlHelper html, string expression, string templateName, object additionalViewData)20 public static MvcHtmlString Editor(this HtmlHelper html, string expression, string templateName, object additionalViewData) { 21 return TemplateHelpers.Template(html, expression, templateName, null /* htmlFieldName */, DataBoundControlMode.Edit, additionalViewData); 22 } 23 Editor(this HtmlHelper html, string expression, string templateName, string htmlFieldName)24 public static MvcHtmlString Editor(this HtmlHelper html, string expression, string templateName, string htmlFieldName) { 25 return TemplateHelpers.Template(html, expression, templateName, htmlFieldName, DataBoundControlMode.Edit, null /* additionalViewData */); 26 } 27 Editor(this HtmlHelper html, string expression, string templateName, string htmlFieldName, object additionalViewData)28 public static MvcHtmlString Editor(this HtmlHelper html, string expression, string templateName, string htmlFieldName, object additionalViewData) { 29 return TemplateHelpers.Template(html, expression, templateName, htmlFieldName, DataBoundControlMode.Edit, additionalViewData); 30 } 31 32 [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "This is an appropriate nesting of generic types")] EditorFor(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression)33 public static MvcHtmlString EditorFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression) { 34 return TemplateHelpers.TemplateFor(html, expression, null /* templateName */, null /* htmlFieldName */, DataBoundControlMode.Edit, null /* additionalViewData */); 35 } 36 37 [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "This is an appropriate nesting of generic types")] EditorFor(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, object additionalViewData)38 public static MvcHtmlString EditorFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, object additionalViewData) { 39 return TemplateHelpers.TemplateFor(html, expression, null /* templateName */, null /* htmlFieldName */, DataBoundControlMode.Edit, additionalViewData); 40 } 41 42 [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "This is an appropriate nesting of generic types")] EditorFor(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, string templateName)43 public static MvcHtmlString EditorFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, string templateName) { 44 return TemplateHelpers.TemplateFor(html, expression, templateName, null /* htmlFieldName */, DataBoundControlMode.Edit, null /* additionalViewData */); 45 } 46 47 [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "This is an appropriate nesting of generic types")] EditorFor(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, string templateName, object additionalViewData)48 public static MvcHtmlString EditorFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, string templateName, object additionalViewData) { 49 return TemplateHelpers.TemplateFor(html, expression, templateName, null /* htmlFieldName */, DataBoundControlMode.Edit, additionalViewData); 50 } 51 52 [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "This is an appropriate nesting of generic types")] EditorFor(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, string templateName, string htmlFieldName)53 public static MvcHtmlString EditorFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, string templateName, string htmlFieldName) { 54 return TemplateHelpers.TemplateFor(html, expression, templateName, htmlFieldName, DataBoundControlMode.Edit, null /* additionalViewData */); 55 } 56 57 [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "This is an appropriate nesting of generic types")] EditorFor(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, string templateName, string htmlFieldName, object additionalViewData)58 public static MvcHtmlString EditorFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, string templateName, string htmlFieldName, object additionalViewData) { 59 return TemplateHelpers.TemplateFor(html, expression, templateName, htmlFieldName, DataBoundControlMode.Edit, additionalViewData); 60 } 61 EditorForModel(this HtmlHelper html)62 public static MvcHtmlString EditorForModel(this HtmlHelper html) { 63 return MvcHtmlString.Create(TemplateHelpers.TemplateHelper(html, html.ViewData.ModelMetadata, String.Empty, null /* templateName */, DataBoundControlMode.Edit, null /* additionalViewData */)); 64 } 65 EditorForModel(this HtmlHelper html, object additionalViewData)66 public static MvcHtmlString EditorForModel(this HtmlHelper html, object additionalViewData) { 67 return MvcHtmlString.Create(TemplateHelpers.TemplateHelper(html, html.ViewData.ModelMetadata, String.Empty, null /* templateName */, DataBoundControlMode.Edit, additionalViewData)); 68 } 69 EditorForModel(this HtmlHelper html, string templateName)70 public static MvcHtmlString EditorForModel(this HtmlHelper html, string templateName) { 71 return MvcHtmlString.Create(TemplateHelpers.TemplateHelper(html, html.ViewData.ModelMetadata, String.Empty, templateName, DataBoundControlMode.Edit, null /* additionalViewData */)); 72 } 73 EditorForModel(this HtmlHelper html, string templateName, object additionalViewData)74 public static MvcHtmlString EditorForModel(this HtmlHelper html, string templateName, object additionalViewData) { 75 return MvcHtmlString.Create(TemplateHelpers.TemplateHelper(html, html.ViewData.ModelMetadata, String.Empty, templateName, DataBoundControlMode.Edit, additionalViewData)); 76 } 77 EditorForModel(this HtmlHelper html, string templateName, string htmlFieldName)78 public static MvcHtmlString EditorForModel(this HtmlHelper html, string templateName, string htmlFieldName) { 79 return MvcHtmlString.Create(TemplateHelpers.TemplateHelper(html, html.ViewData.ModelMetadata, htmlFieldName, templateName, DataBoundControlMode.Edit, null /* additionalViewData */)); 80 } 81 EditorForModel(this HtmlHelper html, string templateName, string htmlFieldName, object additionalViewData)82 public static MvcHtmlString EditorForModel(this HtmlHelper html, string templateName, string htmlFieldName, object additionalViewData) { 83 return MvcHtmlString.Create(TemplateHelpers.TemplateHelper(html, html.ViewData.ModelMetadata, htmlFieldName, templateName, DataBoundControlMode.Edit, additionalViewData)); 84 } 85 } 86 } 87