Skip to Content
Introducing .NET 4.0: with Visual Studio 2010
book

Introducing .NET 4.0: with Visual Studio 2010

by Alex Mackey
February 2010
Beginner content levelBeginner
400 pages
11h 13m
English
Apress
Content preview from Introducing .NET 4.0: with Visual Studio 2010

13.12. Extending MVC

ASP.NET MVC is very easy to customize and extend. You don't like how the view engine works? No problem—you can override it. ASP.NET MVC is a framework practically begging for customization.

13.12.1. Extension Methods

One of the easiest ways to extend the existing ASP.NET MVC functionality is by writing extension methods on some of the HtmlHelper classes. For example, you might need to render a home page link to a specific page throughout your application. To accomplish this, you can create an extension method.

Let's do so now. Create a new class called UrlHelperExtension.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Chapter13.BobsMoviesMVC.Controllers ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

ASP.NET 3.5 For Dummies®

ASP.NET 3.5 For Dummies®

Ken Cox
ASP.NET 4 Unleashed

ASP.NET 4 Unleashed

Stephen Walther, Kevin Hoffman, Nate Dudek

Publisher Resources

ISBN: 9781430224556Purchase book