Please enable JavaScript.
Coggle requires JavaScript to display documents.
ASP.NET Complete Guide (Types of Action Result (Content result (to send…
ASP.NET Complete Guide
-
-
View Engines
ASPX View Engine
- Older and used in MVC 1,2,3,4
- File extn. - .aspx
- syntax is cumbersome, when used in real- world views.
- You can't write html tags in the code blocks
code block --> <% c# .net code %>
Razor View Engine
- latest and supported in MVC 3,4,5.
- extn --> .cshtml
- syntax is very clear, clean and expressive
- you can write html tags in the code blocks.
{ c#.net code }
Partial Views
- PV's are used to create reusable views
- They do not have a layout page
- Also _ViewStart.cs file will not be called for a partial view in it's execution
- PV's doesn't contain any html structured elements such as html, head, body etc;,
{Html.RenderPartial(" ");}
Routing in Asp.net MVC
Route tables contains the mapping for the url
In Application_Start event - Global.asax --> register the routes here
like RouteConfig.RegisterRoutes(RouteTable.Routes);
and in routeconfig file:
routes.MapRoute(
name: -> specifies name of route
url: {param1}/{param2} --> specifies url pattern
defaults: new { param1="",param2=""} --> species default values for parameters
constraints: new {param1="",param2=""} --> specifies parameters for the parameters in regular expressions
-