Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Asp.net MVC

Asp.net MVC

Scheduled Pinned Locked Moved ASP.NET
asp-netcsharparchitecture
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PRAKAS PANDEY
    wrote on last edited by
    #1

    What's the difference between 'model' and 'Model' in Asp.net MVC

    A F 2 Replies Last reply
    0
    • P PRAKAS PANDEY

      What's the difference between 'model' and 'Model' in Asp.net MVC

      A Offline
      A Offline
      Afzaal Ahmad Zeeshan
      wrote on last edited by
      #2

      Model represents the object (instance of the class) in your model. For example, if your model is created as,

      namespace Sample.Models {
      public class Program {
      public string Name { get; set; }
      }
      }

      @model Program

      // Then in your code

      Model.Name

      This would write the value of Name in the paragraph.

      The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

      1 Reply Last reply
      0
      • P PRAKAS PANDEY

        What's the difference between 'model' and 'Model' in Asp.net MVC

        F Offline
        F Offline
        F ES Sitecore
        wrote on last edited by
        #3

        "model" is only used in the page directive at the top of the view to dictate which class the view uses for its model

        @model MyClass

        In the view itself Model represents the model that was passed to the view by the controller;

        return View("MyView.cshtml", instanceOfMyClass)

        So in the MyView.cshtml view code Model will represent instanceOfMyClass

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups