O'Reilly logo

Beginning ASP.NET for Visual Studio 2015 by William Penberthy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 11User Controls and Partial Views

What you will learn in this chapter:

  • What an ASP.NET Web Forms user control is, and how to use it in a website
  • Creating user controls that provide common functionality to multiple pages
  • Creating an ASP.NET MVC partial view and using it in your web application
  • Working with controllers that return partial views
  • How user controls and partial views differ
  • Creating ASP.NET MVC templates

Code Downloads for this Chapter:

The wrox.com code downloads for this chapter are found at www.wrox.com/go/beginningaspnetforvisualstudio on the Download Code tab. The code is in the chapter 11 download and individually named according to the names throughout the chapter.

There was a lot of discussion in Chapter 4, “Programming in C# and VB.NET,” about reusing the same code in multiple areas as opposed to rewriting the code multiple times. This is a useful concept not only when approaching your code design, but also when approaching your page design. You have seen how reuse is provided through the use of master pages and layout pages; now you will learn other ways to provide reusable sections in a web application.

A typical example of this could be something like a login window. While you may want the same functionality on every page, you might prefer that functionality to appear in different places on the page, based on the visitor's current location. Because they may be on different parts of the page, it's not possible to put this functionality into the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required