Creating the Web User Controls

One of the nicest features about writing ASP.NET applications is the ability to create Web User Controls, which are stored in .ascx files. You can think of these as “smart includes.” In classic ASP, server-side includes were one method for bringing in common code and HTML to multiple pages. However, you couldn't pass or change parameters, such as the page title or other pieces of information.

However, Web User Controls have this ability and more. You can create complex code in these controls and then use them as part of Web forms that you create simply by registering them in the page.

To get started, add a new Web User Control to your project and name it header.ascx. The Web User Control has both the front-end (stored ...

Get Creating and Consuming Web Services in Visual Basic® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.