|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Creating Custom Mobile Controls
You can create two types of mobile controls, mobile user controls and custom mobile controls. User controls are created using an .ascx file and inherit from. Custom mobile controls are self-contained objects that inherit from . Creating ASP.NET mobile user controls and custom mobile controls offers you a way to reuse common user interface (UI) functionality across your ASP.NET mobile Web pages.
ASP.NET provides several techniques for writing your own mobile controls. To help determine which type of control is most appropriate for your application, seeand .
With ASP.NET mobile user controls, as in standard ASP.NET user controls, you can use fragment caching — a technique that allows you to cache output from a control independently from the rest of the Web page containing the control. For information about caching output from ASP.NET user controls, see.
When you create ASP.NET mobile Web pages, you must choose a single language, such as Microsoft Visual Basic or C#. However, a single mobile Web page can include user controls and custom controls authored in any language supported by the common language runtime.
In This Section
Explains how to create a reusable custom control for your application by developing your control in an .ascx file.
Describes developing new functionality by writing a new control, inheriting the functionality of a base control, and extending the base control with new methods, properties, or events.
Describes adding application-specific attributes to ASP.NET mobile controls.
Describes developing a control composed of several individual controls.
Describes how to write controls that render differently for different devices, and lists the advantages of using device-specific composition.
Describes creating an ASP.NET mobile control that inherits directly from MobileControl.
Describes how to use control builders to implement custom persistence.