New test.
[mono.git] / mcs / class / System.Web.Mvc2 / System.Web.Mvc / ViewMasterPage`1.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 {\r
14 \r
15     public class ViewMasterPage<TModel> : ViewMasterPage {\r
16         private AjaxHelper<TModel> _ajaxHelper;\r
17         private HtmlHelper<TModel> _htmlHelper;\r
18         private ViewDataDictionary<TModel> _viewData;\r
19 \r
20         public new AjaxHelper<TModel> Ajax {\r
21             get {\r
22                 if (_ajaxHelper == null) {\r
23                     _ajaxHelper = new AjaxHelper<TModel>(ViewContext, ViewPage);\r
24                 }\r
25                 return _ajaxHelper;\r
26             }\r
27         }\r
28 \r
29         public new HtmlHelper<TModel> Html {\r
30             get {\r
31                 if (_htmlHelper == null) {\r
32                     _htmlHelper = new HtmlHelper<TModel>(ViewContext, ViewPage);\r
33                 }\r
34                 return _htmlHelper;\r
35             }\r
36         }\r
37 \r
38         public new TModel Model {\r
39             get {\r
40                 return ViewData.Model;\r
41             }\r
42         }\r
43 \r
44         public new ViewDataDictionary<TModel> ViewData {\r
45             get {\r
46                 if (_viewData == null) {\r
47                     _viewData = new ViewDataDictionary<TModel>(ViewPage.ViewData);\r
48                 }\r
49                 return _viewData;\r
50             }\r
51         }\r
52     }\r
53 }\r