Partilhar via


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 MobileUserControl. Custom mobile controls are self-contained objects that inherit from System.Web.UI.MobileControls.MobileControl. 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, see ASP.NET User Controls Overview and Developing Custom ASP.NET Server Controls.

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 Caching Portions of an ASP.NET Page.

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

  • User Controls
    Explains how to create a reusable custom control for your application by developing your control in an .ascx file.
  • Extending Functionality with Inheritance
    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.
  • Composite Controls
    Describes developing a control composed of several individual controls.
  • Device-Specific Composition
    Describes how to write controls that render differently for different devices, and lists the advantages of using device-specific composition.

See Also

Reference

MobileControl

Concepts

ASP.NET User Controls Overview

Other Resources

Extensibility Developer's Guide
Developing Custom ASP.NET Server Controls