ViewPage<TModel>.ViewData Property
Gets or sets a dictionary that contains data to pass between the controller and the view.
Namespace: System.Web.Mvc
Assembly: System.Web.Mvc (in System.Web.Mvc.dll)
Syntax
'Declaration
Public Property ViewData As ViewDataDictionary(Of TModel)
Get
Set
public ViewDataDictionary<TModel> ViewData { get; set; }
public:
property ViewDataDictionary<TModel>^ ViewData {
ViewDataDictionary<TModel>^ get ();
void set (ViewDataDictionary<TModel>^ value);
}
Property Value
Type: System.Web.Mvc.ViewDataDictionary<TModel>
A dictionary that contains data to pass between the controller and the view.
Remarks
The controller can add key/values pairs to the view data. The data is passed to the view when the view is rendered. The view can add to or change the data, which will be sent to the controller when the view is posted as part of a request.