Implementing Custom Persistence

You can implement customized persistence formats for ASP.NET server controls by using a customized control builder. The MobileControl base class has its own control builder, the MobileControlBuilder class. All control builders implemented for ASP.NET mobile controls must inherit from the MobileControlBuilder class.

To implement custom persistence

  1. Create a control builder class using the following outline:

    namespace MyCompany.MyMobileControls
    {
        /*
         * Control builder for my controls
         */
    
        public class MyControlBuilder : MobileControlBuilder
        {
            // Insert your code here.
        }
    }
    
  2. Add a ControlBuilder attribute to the control for which you are writing the control builder class:

    [
       ControlBuilderAttribute(Typeof(ListControlBuilder)),
    ]
    public class List : PagedControl,INamingContainer,IListControl,ITemplateable,
       IPostBackEventHandler
    {
    // Add code here.
    }
    

    ASP.NET uses control builder objects when a page is parsed and compiled.

Controls with Specialized Control Builders

The following table lists the mobile controls that have specialized control builders. If you create a control to inherit properties from another control and you want to implement custom persistence, you must use a class that inherits the ControlBuilder base class.

Control class

Control builder class

DeviceSpecific

DeviceSpecificControlBuilder

List

ListControlBuilder

MobileControl

MobileControlBuilder

ObjectList

ObjectListControlBuilder

Panel

PanelControlBuilder

StyleSheet

StyleSheetControlBuilder

See Also

Concepts

Writing Your Own Mobile Web Controls

Other Resources

Creating Custom Mobile Controls