
Custom Server Controls | 139
User and
Server Controls
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
As you can see, whether the control is used programmatically or declaratively, the
amount of code necessary to provide simple blogging functionality is made trivial
by the use of a custom server control. Note that you can also have the same page
use the Blog control in either Display or Add mode, depending on the user’s
actions, as explained in the following section.
Adding Design-Time Support
While using the Blog control in a Web Forms page is fairly simple, it’s still not
100% intuitive. For example, without documentation, there’s no way for someone
using the Blog control to know what the appropriate values for the Mode prop-
erty are. Without explicitly telling developers using the control about the Add
mode, it would be difficult for them to discover and use this mode on their own.
For developers using Visual Studio .NET (or another IDE that supports Intel-
liSense), you can solve this problem by adding design-time support to the control.
This is done by using a combination of special metadata attributes added to the
control and custom XSD schemas to support IntelliSense statement completion
for Web Forms pages. IntelliSense support in code-behind modules is automatic
and requires no additional coding.
Part of the challenge of providing ...