Routing is a mechanism to process the incoming url that is more descriptive and give desired response. In this case, URL is not mapped to specific files or folder as was the case of earlier days web sites. There are two types of routing (after the introduction of ASP.NET MVC 5). Convention based routing: to define this type of routing, we call MapRoute method and set its unique name, url pattern and specify some default values. Attribute based routing: to define this type of routing, we specify the Route attribute in the action method of the controller. Routing is the URL pattern that is mappped together to a handler,rounting is responsible for incoming browser request for particular MVC controller. In other ways let us say routing help you to define a URL structure and map the URL with controller. There are three segments for routing that are important, ControllerName ActionMethodName Parammeter i.e: ControllerName/ActionMethodName/{ParamerName} and als...
Both of them provide the same HTML output, “HTML.TextBoxFor” is strongly typed while “HTML.TextBox” isn’t. Below is a simple HTML code which just creates a simple textbox with “CustomerCode” as name. Html.TextBox("CustomerCode") Below is “Html.TextBoxFor” code which creates HTML textbox using the property name ‘CustomerCode” from object “m”. Html.TextBoxFor(m => m.CustomerCode) In the same way we have for other HTML controls like for checkbox we have “Html.CheckBox” and “Html.CheckBoxFor”.
View: It contains the layout page. Before any view is rendered, viewstart page is rendered. View might have markup tags like body, html, head, title, meta etc. View is not lightweight as compare to Partial View. Partial View: It does not contain the layout page. Partial view does not verify for a viewstart.cshtml.We cannot put common code for a partial view within the viewStart.cshtml.page. Partial view is designed specially to render within the view and just because of that it does not consist any mark up. We can pass a regular view to the RenderPartial method.
Comments
Post a Comment