Using Controls

Controls are compiled code residing in .DLL files that can be accessed by the server. In many cases, these controls are part of the .NET Framework, but you can also create and use custom controls.

Declaring a Control

In order for a control to be visible to the application, it must be registered with the server. In traditional ASP, this was accomplished with regsrvr32. exe, and required you to shut down all Web services to make a change. In ASP.NET, registration is accomplished when the page is run via the Register directive:

<%@ Register TagPrefix="cust" Namespace="MyCustomCtrls" Assembly="MyDLLFile" %>

The preceding example assumes that the MyDLLFile.DLL file is in the bin directory for the application.

Referencing a Control ...

Get ASP.NET by Example 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.