Udostępnij za pośrednictwem


Introduction to Programmer-Defined Controls 

ASP.NET mobile controls support four types of programmer-defined controls:

  • Mobile user controls

  • Controls extended through inheritance

  • Composite controls

  • Custom controls

You can use programmer-defined controls in the same manner as existing ASP.NET mobile controls. For information about which type of programmer-defined control is most appropriate for your application, see ASP.NET Web Server Controls Overview.

NoteNote

An ASP.NET Mobile Web application is any Web site that contains at least one ASP.NET mobile Web page. In Visual Studio .NET 2003, the ASP.NET Mobile Toolkit provided an ASP.NET Mobile Web Designer, but that functionality is an integral part of Visual Studio 2005.

Mobile User Controls

In most respects, a mobile user control is like an ASP.NET mobile Web page. You can add controls and content to it, and then use it as a control in a page. Mobile user controls are stored in .ascx files and can have code in the same control (a single-file control) or in an associated code-behind file. For more information, see User Controls. For information about how to create mobile user controls in the designer, see Creating an ASP.NET Mobile User Control.

Mobile Controls and Inheritance

Your application can use inheritance to derive controls from existing ASP.NET mobile controls. Your derived controls can override existing members and can provide new properties, methods, and events. For more information, see Extending Functionality with Inheritance.

Composite Controls

You can create composite controls by combining existing controls and content. In this respect, composite controls are like mobile user controls. However, they are created and stored differently. For more information, see Composite Controls.

Custom Controls

For greatest flexibility, you can write custom controls. Like the existing ASP.NET mobile controls, your controls must inherit from the MobileControl class or from an existing mobile control. In addition, they must adhere to a set of guidelines. For more information, see Writing Your Own Mobile Web Controls.

Control Extensibility

You can build custom designers for your custom controls. However, as with ASP.NET Web controls, you cannot create custom designers for user controls represented by .ascx files. Custom designers for mobile controls must inherit from ControlDesigner and must also implement the IMobileDesigner interface.

See Also

Reference

ControlDesigner
IMobileDesigner

Concepts

Creating an ASP.NET Mobile User Control
Writing Your Own Mobile Web Controls

Other Resources

Creating New Controls for ASP.NET Mobile Pages