New test.
[mono.git] / mcs / class / System.Web.Mvc2 / System.Web.Mvc / Html / EditorExtensions.cs
1 /* ****************************************************************************\r
2  *\r
3  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4  *\r
5  * This software is subject to the Microsoft Public License (Ms-PL). \r
6  * A copy of the license can be found in the license.htm file included \r
7  * in this distribution.\r
8  *\r
9  * You must not remove this notice, or any other, from this software.\r
10  *\r
11  * ***************************************************************************/\r
12 \r
13 namespace System.Web.Mvc.Html {\r
14     using System;\r
15     using System.Linq.Expressions;\r
16     using System.Web.UI.WebControls;\r
17 \r
18     public static class EditorExtensions {\r
19         public static MvcHtmlString Editor(this HtmlHelper html, string expression) {\r
20             return TemplateHelpers.Template(html, expression, null /* templateName */, null /* htmlFieldName */, DataBoundControlMode.Edit, null /* additionalViewData */);\r
21         }\r
22 \r
23         public static MvcHtmlString Editor(this HtmlHelper html, string expression, object additionalViewData) {\r
24             return TemplateHelpers.Template(html, expression, null /* templateName */, null /* htmlFieldName */, DataBoundControlMode.Edit, additionalViewData);\r
25         }\r
26 \r
27         public static MvcHtmlString Editor(this HtmlHelper html, string expression, string templateName) {\r
28             return TemplateHelpers.Template(html, expression, templateName, null /* htmlFieldName */, DataBoundControlMode.Edit, null /* additionalViewData */);\r
29         }\r
30 \r
31         public static MvcHtmlString Editor(this HtmlHelper html, string expression, string templateName, object additionalViewData) {\r
32             return TemplateHelpers.Template(html, expression, templateName, null /* htmlFieldName */, DataBoundControlMode.Edit, additionalViewData);\r
33         }\r
34 \r
35         public static MvcHtmlString Editor(this HtmlHelper html, string expression, string templateName, string htmlFieldName) {\r
36             return TemplateHelpers.Template(html, expression, templateName, htmlFieldName, DataBoundControlMode.Edit, null /* additionalViewData */);\r
37         }\r
38 \r
39         public static MvcHtmlString Editor(this HtmlHelper html, string expression, string templateName, string htmlFieldName, object additionalViewData) {\r
40             return TemplateHelpers.Template(html, expression, templateName, htmlFieldName, DataBoundControlMode.Edit, additionalViewData);\r
41         }\r
42 \r
43         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures",\r
44             Justification = "This is an appropriate nesting of generic types")]\r
45         public static MvcHtmlString EditorFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression) {\r
46             return TemplateHelpers.TemplateFor(html, expression, null /* templateName */, null /* htmlFieldName */, DataBoundControlMode.Edit, null /* additionalViewData */);\r
47         }\r
48 \r
49         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures",\r
50             Justification = "This is an appropriate nesting of generic types")]\r
51         public static MvcHtmlString EditorFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, object additionalViewData) {\r
52             return TemplateHelpers.TemplateFor(html, expression, null /* templateName */, null /* htmlFieldName */, DataBoundControlMode.Edit, additionalViewData);\r
53         }\r
54 \r
55         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures",\r
56             Justification = "This is an appropriate nesting of generic types")]\r
57         public static MvcHtmlString EditorFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, string templateName) {\r
58             return TemplateHelpers.TemplateFor(html, expression, templateName, null /* htmlFieldName */, DataBoundControlMode.Edit, null /* additionalViewData */);\r
59         }\r
60 \r
61         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures",\r
62             Justification = "This is an appropriate nesting of generic types")]\r
63         public static MvcHtmlString EditorFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, string templateName, object additionalViewData) {\r
64             return TemplateHelpers.TemplateFor(html, expression, templateName, null /* htmlFieldName */, DataBoundControlMode.Edit, additionalViewData);\r
65         }\r
66 \r
67         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures",\r
68             Justification = "This is an appropriate nesting of generic types")]\r
69         public static MvcHtmlString EditorFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, string templateName, string htmlFieldName) {\r
70             return TemplateHelpers.TemplateFor(html, expression, templateName, htmlFieldName, DataBoundControlMode.Edit, null /* additionalViewData */);\r
71         }\r
72 \r
73         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures",\r
74             Justification = "This is an appropriate nesting of generic types")]\r
75         public static MvcHtmlString EditorFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, string templateName, string htmlFieldName, object additionalViewData) {\r
76             return TemplateHelpers.TemplateFor(html, expression, templateName, htmlFieldName, DataBoundControlMode.Edit, additionalViewData);\r
77         }\r
78 \r
79         public static MvcHtmlString EditorForModel(this HtmlHelper html) {\r
80             return MvcHtmlString.Create(TemplateHelpers.TemplateHelper(html, html.ViewData.ModelMetadata, String.Empty, null /* templateName */, DataBoundControlMode.Edit, null /* additionalViewData */));\r
81         }\r
82 \r
83         public static MvcHtmlString EditorForModel(this HtmlHelper html, object additionalViewData) {\r
84             return MvcHtmlString.Create(TemplateHelpers.TemplateHelper(html, html.ViewData.ModelMetadata, String.Empty, null /* templateName */, DataBoundControlMode.Edit, additionalViewData));\r
85         }\r
86 \r
87         public static MvcHtmlString EditorForModel(this HtmlHelper html, string templateName) {\r
88             return MvcHtmlString.Create(TemplateHelpers.TemplateHelper(html, html.ViewData.ModelMetadata, String.Empty, templateName, DataBoundControlMode.Edit, null /* additionalViewData */));\r
89         }\r
90 \r
91         public static MvcHtmlString EditorForModel(this HtmlHelper html, string templateName, object additionalViewData) {\r
92             return MvcHtmlString.Create(TemplateHelpers.TemplateHelper(html, html.ViewData.ModelMetadata, String.Empty, templateName, DataBoundControlMode.Edit, additionalViewData));\r
93         }\r
94 \r
95         public static MvcHtmlString EditorForModel(this HtmlHelper html, string templateName, string htmlFieldName) {\r
96             return MvcHtmlString.Create(TemplateHelpers.TemplateHelper(html, html.ViewData.ModelMetadata, htmlFieldName, templateName, DataBoundControlMode.Edit, null /* additionalViewData */));\r
97         }\r
98 \r
99         public static MvcHtmlString EditorForModel(this HtmlHelper html, string templateName, string htmlFieldName, object additionalViewData) {\r
100             return MvcHtmlString.Create(TemplateHelpers.TemplateHelper(html, html.ViewData.ModelMetadata, htmlFieldName, templateName, DataBoundControlMode.Edit, additionalViewData));\r
101         }\r
102     }\r
103 }\r