Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
SetModel Method
Collapse the table of content
Expand the table of content

ViewDataDictionary(TModel).SetModel Method

Sets the data model to use for the view.

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

abstract SetModel : 
        value:Object -> unit  
override SetModel : 
        value:Object -> unit

Parameters

value
Type: System.Object

The data model to use for the view.

ExceptionCondition
InvalidOperationException

An error occurred while the model was being set.

This method executes before the derived type's instance constructor executes. Derived types must take this into consideration. For example, the logic in the SetModel method must not depend on the this pointer (Me in Visual Basic) to reference a fully constructed object.

Show:
© 2015 Microsoft