Chapter 12. DotNetNuke User Controls

In the Guestbook module you have created so far, you have already used one of the DotNetNuke user controls, the Label control. The DotNetNuke core provides many more helpful controls that can be used to provide a robust, user-friendly interface.

This chapter introduces a few of these items, and, when possible, implements them in the Guestbook modules to demonstrate proper use. The chapter begins by providing information about how to register the tags for all of the DotNetNuke user controls. After that, you'll learn about each of the controls, with implementation examples provided along the way, including demonstrations of when you might use the control. The chapter concludes with a summary of the benefits of using these controls.

Registering the Controls

With the exception of Label and a handful of other controls, all DotNetNuke Web controls are contained as compiled controls inside the DotNetNuke.UI.WebControls namespace. Therefore, a single Register tag can handle registering them for use. This Register tag must be added at the top of any .ascx control that needs to use the controls. As illustrated by the following, the code is the same for C# and VB:

<%@ Register TagPrefix="dnn" Assembly="DotNetNuke"
     Namespace="DotNetNuke.UI.WebControls" %>

This single Register tag grants access to all controls inside the DotNetNuke.UI.WebControls namespace. Inside the modified .ascx file, if you now type <dnn:, you will see IntelliSense information on all available ...

Get Professional DotNetNuke® Module Programming 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.