sumank
what is strongly typed view in Asp.Net MVC?
By sumank in ASP.NET MVC on May 10 2013
  • Jignesh Trivedi
    Apr, 2014 24

    It is view that is render using specific types of model objects.@model Project.MyModelIn this template we get the intellisense support. Strongly-typed view has following advantages.1) Intellisense 2) Compile time type checking 3) Automatic scaffolding

    • 7
  • Swaraj Patil
    May, 2014 27

    The view which bind with any model is called as strogly typed view. You can bind any class as model to view.You can access model properties on that view. You can use data associated with model to render controls. You can bind custom types as well as primitive types like string, array, list etc. to view. e.g.public class UserModel {} Controller - public ActionResult View1() {UserModel obj = new UserModel();return view(obj) } View - @model MyProject.UserModel ORController - public ActionResult View1() { string[] arrStr = new string[5];return view(arrStr) } View - @model string[]Again Main advantage of using strongly typed view is - You can same object during posting view. So Whater values assigned to controls associated models property. You can access in post action-[HTTPPOST] public ActionResult View1(UserModel obj) { obj.save(); return view(); }It will be very using to post model at server side. Suppose we using strongly typed to add something. We can model details in post action and we can perform save operation on that object.

    • 3
  • Satish
    Jun, 2014 12

    A Strongly Typed view means it has a ViewModel associated to it that the controller is passing to it and all the elements in that View can use those ViewModel propertiesYou can have strongly typed partials as well. Meaning that piece of Html needs specific data so you type it to a certain ViewModelHere is an example of a Strongly Typed View@model SomeViewModel...// all the html comes afterA view that is strongly typed have a @model SomeViewModel lineHere's one that renders a strongly typed Viewpublic ActionResult Index() {var model = new SomeViewModel();return View(model); }And the view makes use of that ViewModel by having the @model SomeViewModel at the top of the file.So now that the view has a ViewModel I can display elements that are bound to the ViewModel like

    @Model.Name

    @Model.Location

    OR for [email protected](m => m.Name) @Html.TextBoxFor(m => m.Location)

    • 1
  • Hamid Khan
    Dec, 2018 27

    strongly typed view in Asp.Net MVC 1- Intellisense 2- scaffolding 3- Compile time type checking

    • 0
  • Deep Nk
    Jun, 2016 12

    The view, that is designed by targeting specific model class object, then that view is called "Strongly Typed View". In strongly typed view , view is bind with corresponding model class object/objects. Scaffolding Template works based on strongly typed view.

    • 0
  • Deep Nk
    Jun, 2016 12

    The view, that is designed by targeting specific model class object, then that view is called "Strongly Typed View". In strongly typed view , view is bind with corresponding model class object/objects. Scaffolding Template works based on strongly typed view.

    • 0
  • Deep Nk
    Jun, 2016 12

    The view, that is designed by targeting specific model class object, then that view is called "Strongly Typed View". In strongly typed view , view is bind with corresponding model class object/objects. Scaffolding Template works based on strongly typed view.

    • 0
  • Deep Nk
    Jun, 2016 12

    The view, that is designed by targeting specific model class object, then that view is called "Strongly Typed View". In strongly typed view , view is bind with corresponding model class object/objects. Scaffolding Template works based on strongly typed view.

    • 0
  • Damodar A
    Apr, 2014 14

    It is sacfloding view which is auto generated view.

    • 0
  • sumank
    May, 2013 10

    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.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS