Tutorialsteacher

Follow Us

Articles
  • C#
  • C# OOP
  • ASP.NET Core
  • ASP.NET MVC
  • LINQ
  • Inversion of Control (IoC)
  • Web API
  • JavaScript
  • TypeScript
  • jQuery
  • Angular 11
  • Node.js
  • D3.js
  • Sass
  • Python
  • Go lang
  • HTTPS (SSL)
  • Regex
  • SQL
  • SQL Server
  • PostgreSQL
  • MongoDB
Entity Framework Extensions - Boost EF Core 9
  Bulk Insert
  Bulk Delete
  Bulk Update
  Bulk Merge
  • All
  • C#
  • MVC
  • Web API
  • Azure
  • IIS
  • JavaScript
  • Angular
  • Node.js
  • Java
  • Python
  • SQL Server
  • SEO
  • Entrepreneur
  • Productivity

ASP.NET MVC View detail

Every view in ASP.NET MVC is derived from the WebViewPage class. The following figure shows class hierarchy.

View class hierarchy

The Web.config file in the Views folder, indicates that the base type of every page is the System.Web.Mvc.WebViewPage as shown below:

Base type of razor view:
<system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization"/>
        <add namespace="System.Web.Routing" />
        <add namespace="MVC_BasicTutorials" />
      </namespaces>
    </pages>
</system.web.webPages.razor>

So, you can use any of the method and properties of WebViewPage and its base classes, such as WebPageBase, WebPageRenderingBase & WebPageExecutingBase, starting with the @ symbol.

The WebViewPage class includes following members.

PropertyDescription
AjaxGets or sets the AjaxHelper object that is used to render HTML using Ajax.
HtmlGets or sets the HtmlHelper object that is used to render HTML elements.
ModelGets the Model property of the associated ViewDataDictionary object.
ViewBagGets the view bag.
ViewContextGets or sets the information that is used to render the view.
ViewDataGets or sets a dictionary that contains data to pass between the controller and the view.

Visit MSDN for detailed information on the WebViewPage members.

Thus, when you use the HtmlHelper class using @Html, you actually use the HtmlHelper class assigned to the Html property of WebViewPage.

TUTORIALSTEACHER.COM

TutorialsTeacher.com is your authoritative source for comprehensive technologies tutorials, tailored to guide you through mastering various web and other technologies through a step-by-step approach.

Our content helps you to learn technologies easily and quickly for learners of all levels. By accessing this platform, you acknowledge that you have reviewed and consented to abide by our Terms of Use and Privacy Policy, designed to safeguard your experience and privacy rights.

[email protected]

ABOUT USTERMS OF USEPRIVACY POLICY
copywrite-symbol

2024 TutorialsTeacher.com. (v 1.2) All Rights Reserved.