
260Microsoft Visual Studio 2010: A Beginner’s Guide
Moving from the top of Listing
The rest of the page is framed inside of HTML tags and ASP.NET MVC markup. The html tag states that this is an HTML document. HTML documents have two parts, a head and a body, where the head is for metadata describing the page and the body contains display content.
In HTML, a div tag blocks off a chunk of HTML and is useful for layout and organization of the page. The Hx tags, where x is a number between 1 and 6, describe headers, where h1 is the largest and h6 is the smallest.
The ContentPlaceHolder controls are instrumental to the success of the MasterPage. If you look at the Content tags in Listing
If you recall from the last section, Listing
The ActionLink method has three parameters: id, controller, and action. When the ActionLink renders in the browser, it will transform into an anchor tag, a, with an id specified in the first parameter of ActionLink. When the user clicks the link in the browser, the application will navigate to the Controller in the third parameter of ActionLink and invoke the action in the second parameter of ActionLink. So, if the user clicked the link produced by ActionLink("About", "About", "Home"), ASP.NET MVC will invoke the About action of the Home Controller. The next section discusses RenderPartial in more detail.
Partial Views (a.k.a. User Controls)
It’s often the case that you’ve written View content on one page and need the same identical content on two or more pages. As explained with MasterPages, you want to avoid the maintenance work that comes with updating all of the content that is the same on multiple pages. While MasterPages are good for content that decorates pages across an entire site, a Partial View is ideal for limited reuse of View content on different pages of a site.