Authoring


The technique for authoring a custom control is quite different from the one that is used for authoring a user control.

Custom controls are authored by writing a managed class that derives directly or indirectly from System.Web.UI.Control in a .NET programming language. There is no designer support for authoring custom controls. Custom controls provide an effective way to extend an existing control with new or modified functionality.

At run time, the dynamically compiled user control class also indirectly derives from System.Web.UI.Control . However, user controls are authored declaratively in the form of .ascx files, which is very similar to the way ASP.NET pages are designed and developed. A designer such as Microsoft Visual Studio .NET supports drag-and-drop layout for authoring user controls, just as it does for authoring ASP.NET pages. The authoring experience for user controls, which includes visual layout and declarative persistence, is thus simpler and much more suited to rapid application development (RAD). The user control model should be especially useful to page developers who are looking for a quick and easy way to create server controls.

Note

If you need to extend or modify the functionality of an existing control, create a custom control that derives from the existing control. Do not place an instance of the control inside a user control to add functionality and behavior to it because the user control approach does not retain or enable programming against the existing control's object model. You should develop a user control only when you want to provide new functionality by combining more than one existing control.




Developing Microsoft ASP. NET Server Controls and Components
Developing Microsoft ASP.NET Server Controls and Components (Pro-Developer)
ISBN: 0735615829
EAN: 2147483647
Year: 2005
Pages: 183

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net