1 /* ****************************************************************************
\r
3 * Copyright (c) Microsoft Corporation. All rights reserved.
\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
9 * You must not remove this notice, or any other, from this software.
\r
11 * ***************************************************************************/
\r
13 namespace System.Web.Mvc {
\r
14 using System.Diagnostics.CodeAnalysis;
\r
16 public class ViewUserControl<TModel> : ViewUserControl where TModel : class {
\r
17 private AjaxHelper<TModel> _ajaxHelper;
\r
18 private HtmlHelper<TModel> _htmlHelper;
\r
19 private ViewDataDictionary<TModel> _viewData;
\r
21 public new AjaxHelper<TModel> Ajax {
\r
23 if (_ajaxHelper == null) {
\r
24 _ajaxHelper = new AjaxHelper<TModel>(ViewContext, this);
\r
30 public new HtmlHelper<TModel> Html {
\r
32 if (_htmlHelper == null) {
\r
33 _htmlHelper = new HtmlHelper<TModel>(ViewContext, this);
\r
39 public new TModel Model {
\r
41 return ViewData.Model;
\r
45 [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
\r
46 public new ViewDataDictionary<TModel> ViewData {
\r
56 protected override void SetViewData(ViewDataDictionary viewData) {
\r
57 _viewData = new ViewDataDictionary<TModel>(viewData);
\r
59 base.SetViewData(_viewData);
\r