SCRUMble ! Hello Blog Readers! Thank you for all your support and encouragement. I have something exciting for you all. I have recently written and published a new book called 'SCRUMble !'. It is currently available on pothi store. It will be soon available on Amazon and Flipkart as well. Please get your copy and do let me know your reviews. -Abhishek Sathe SCRUMble ! Written and Published by: Abhishek Sathe Distributed by: pothi.com Order your copy now: https://store.pothi.com/book/abhishek-sathe-scrumble/ Coming soon on Amazon and Flipkart About the book: Scrum is a framework for solving complex problems largely adapted by Software Development field. There are multiple ag...
Model, View and Controller are the three most important folders that you can see in an ASP.NET MVC project while using Visual Studio 2013.
When you type /HOME/ABOUT in the URL, HOME controller from Controller folder gets activated (particularly About method gets activated) which builds a Model to satisfy the incoming requests and View is the one which views the model. In above example, About.cshtml is the view that views the model.
Views can be returned by two types:
In Views->Shared folder, you can find a file named _Layout.cshtml which has common layout of all pages.
In Views->Shared folder, you can find a file named _ViewStart.cshtml where we specify that _Layout.cshtml is our Layout file.
In _Layout.cshtml file, we need to compulsorily call RenderBody() function. RenderSection() is optional call to render layout of a particular section.
In _Layout.cshtml, we can add a new Link by using Html.ActionLink. ActionLink is an example of Html Helper.
Html is a property of the ViewPage base class. It includes:
-Create Inputs
-Create Links
-Create Forms
Partial Views can be used to review already existing model.
When you type /HOME/ABOUT in the URL, HOME controller from Controller folder gets activated (particularly About method gets activated) which builds a Model to satisfy the incoming requests and View is the one which views the model. In above example, About.cshtml is the view that views the model.
Views can be returned by two types:
- ViewBag - For example, ViewBag.Name="Abhishek" from About action method can be rendered as <div>Name:@ViewBag.Name</div> in view About.cshtml.
- Strongly Typed Models - For example, we can create a model in Models->Add->Class named 'AboutModel'. In AboutModel constructor, we can write public string Name {get; set;}. In About action method we can write, var model = new AboutModel(); model.Name = "Abhi"; return View(model); This can be rendered in View as <h2>@Model.Name</h2>
In Views->Shared folder, you can find a file named _Layout.cshtml which has common layout of all pages.
In Views->Shared folder, you can find a file named _ViewStart.cshtml where we specify that _Layout.cshtml is our Layout file.
In _Layout.cshtml file, we need to compulsorily call RenderBody() function. RenderSection() is optional call to render layout of a particular section.
In _Layout.cshtml, we can add a new Link by using Html.ActionLink. ActionLink is an example of Html Helper.
Html is a property of the ViewPage base class. It includes:
-Create Inputs
-Create Links
-Create Forms
Partial Views can be used to review already existing model.
Comments
Post a Comment