| Define ViewBag in MVC |
| ViewBag is used to pass data from a controller to the view.ViewBag object holds the data. |
Define ViewBag in MVC
Labels:
MVC
Define Helper Classes
| Define Helper Classes |
| There are several Helper classes in MVC frame work. 1.Form Helper- Radio buttons, textboxes,list boxes etc. 2.URL helpers 3.HTML helpers- Encode, Decode, AttributeEncode, and RenderPartial. |
Labels:
MVC
Define Non-Action Methods
| Define Non-Action Methods |
|
Labels:
MVC
Define Action Methods Parameters
| Define Action Methods Parameters |
|
Labels:
MVC
Define MVC Attributes
| Define MVC Attributes |
|
Labels:
MVC
Define ActionResult Return Type
| Define ActionResult Return Type |
|
Labels:
MVC
Define Action methods
| Define Action methods |
|
Labels:
MVC
Define Types of Action Filters
| Define Types of Action Filters |
| 1. Authorization filters Implements the IAuthorizationFilter attribute. This filter is always executed first. 2. Action filters Implements the IActionFilter attribute. You can use this filter to modify the viewdata that an action returns. 3. Result filters Implements the IResultFilter attribute. Eg You might want to modify the view result before view is redered to the browser. 4. Exception filters Implements the IExceptionFilter attribute. Can be used to log errors, raised by your controller action or controller action results. |
Labels:
MVC
Define MVC Action Filters
| Define MVC Action Filters |
| Action Filters are used in cases where we need to perform some logic either before an action method is called or after an action method runs. |
Labels:
MVC
Request Flow in MVC
| Request Flow in MVC |
| Answer:Request -->Routing --> Handler -->Controller --> Action --> View --> Response |
Labels:
MVC
Model View Controller
Today, we see What is mean by MVC [Model View Control]
Model:
- Model is basically a C# or VB.Net Class.
- Model is accessible by Both Controller and View.
- Model can be used to pass data from Controller to View.
- View can use model to display data in Page.
- View is an ASPX Page without having a Code Behide file.
- All Pate specific HTML generation and formatting can be done inside view.
- One can use inline Code(Server tags) to develop dynamic pages.
- Controller is a basically a C# or VB.net class which inherits System.MVC.Controller.
- controller is a Heart of Entire MVC Architecture.
- Inside Controller's Class action methods can be implemented which are responsible to responding to browser or calling views.
- Controller can access and use model class to pass data to views
- Controller uses ViewData to pass any data to view.
Labels:
MVC