Slides
Slides
Slides
Technology Stack
ASP.NET MVC
ASP.NET Framework
(Configuration, Security, Membership, Roles, Profiles, Routing, Caching, Session, Application State, Cookie, .aspx/.ascx/.asax/.master files etc.
.NET Framework
Controller Factory
MvcHandler
forwards
Controller
invokes
Model
Action produces Action Result View Engine produces View Result defines View
FileResult
JsonResult JavaScriptResult HttpUnauthorizedResult EmptyResult
HTML Helpers
Partial views
Built-in or extension methods for HtmlHelper class, e.g. Html.TextBox(), Html.BeginForm() etc.
Render MVC user controls, which can be reused in many places, e.g. Html.RenderPartial(ProductEdit)
Partial action
Server controls
Invoke an MVC action and render resulted action result, e.g. Html.RenderAction(ProductCount")
Using standard ASPX control registration & using syntax
Note: not recommended unless reusing existing controls (which dont depend on view state and/or post back)
Corresponding HTML
<input id=" name=" type="checkbox" value=" /> <input id=" name=" type="text" value=" /> <textarea id=" name=" ></textarea> <input id=" name=" type=" value=" />
Html.RadioButton/For () <input checked=" id=" name=" type=" value=" /> Html.Hidden/For () Html.BeginForm/For (...) <input id=" name=" type=" value=" /> <form id= ></form>
Attribute
Range RegularExpression Required StringLength Validation
Description
Validates whether the property value falls in a min-max range Validates the property against a specified regular expression Validates whether the property value is provided Validates the maximum length of a property value The base class for all validation attributes, including custom attributes
Description Used in Html.Label()/LabelFor() to generate the label text Generates a hidden input for the property Indicates the data type of the property (e.g. Email, Password) Indicates whether the property should be shown or ignored
DisplayFormat
ReadOnly UIHint
Types of Filter
Filter Type Authorization filter
Action filter Result filter Exception filter
Interface
IActionFilter IResultFilter IExceptionFilter
Methods to Override
OnActionExecuting(), OnActionExecuted() OnResultExecuting(), OnResultExecuted() OnException()
IAuthorizationFilter OnAuthorization()