i'm trying to create a strongly-typed view using Visual Studio 2008. I can right-click a controller action and choose: Add view... In the next dialog window there is an option 'Create a strongly-typed view'. If I check this option I can select a list of classes that are in my current project.
However I cannot select the class I need which is in a class-library that I referenced.
Any suggestions?
Strongly typed views are used for rendering specific types of model objects, instead of using the general ViewData structure. By specifying the type of data, you get access to IntelliSense for the model class.
This is done using The @model directive, which is placed at the top of the view file specifying the type of the ViewModel that is being passed. When you use @model directive, the razor engine assigns that type to the Viewdata. Model property The Model property then returns the type declared.
Strongly typed views are used for rendering specific types of model objects. By specifying type of data, visual studio provides intellisense for that class. View inherits from ViewPage whereas strongly typed view inherits from ViewPage where T is type of the model.
This is surely to late for answering this question,but for future readers:
i noticed that very often i have to build->clean solution and then to build->rebuild solution and the classes magically appear (as they should)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With