Export (0) Print
Expand All
9 out of 11 rated this helpful - Rate this topic

ASP.NET Server Control Development Basics

.NET Framework 1.1

The following list describes typical scenarios in which you are likely to develop your own controls and provides links to other topics for further information.

  • You have created an ASP.NET page that provides a user interface that you want to reuse in another application. You want to create a server control that encapsulates the user interface (UI) but do not want to write additional code. ASP.NET allows you to save your page as a user control without writing a single additional line of code. For details, see Web Forms User Controls.
  • You want to develop a compiled control that combines the functionality of two or more existing controls. For example, you need a control that encapsulates a button and a text box. You can do this using control composition, as described in Developing a Composite Control.
  • An existing ASP.NET server control almost meets your requirements but lacks some required features. You can customize an existing control by deriving from it and overriding its properties, methods, or events.
  • None of the existing ASP.NET server controls (or their combinations) meet your requirements. In that case, you can create a custom control by deriving from one of the base control classes. These classes provide all the plumbing needed by an ASP.NET server control, thus allowing you to focus on programming the features you need. To get started, see Developing Custom Controls: Key Concepts and Developing a Simple ASP.NET Server Control.

Many custom controls involve a combination of scenarios, where you combine existing ASP.NET server controls with custom controls that you have designed.

Note   The authoring paradigm outlined in the first bullet (user controls) is very different from that for the other scenarios. User controls are written using the same programming model as ASP.NET pages, and they are ideal for rapid control development. The other scenarios involve object-oriented programming in languages that target the common language runtime, such as Visual Basic .NET and C#. A user control is saved as an .ascx page, which is a text file, while the other scenarios create controls that are compiled and persisted in assemblies. For a summary of differences, see Composite Control vs. User Control.

See Also

Developing Custom Controls: Key Concepts | Developing a Simple ASP.NET Server Control

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.