Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

SPMobileBaseFieldControl.CreateControlForNew Method

Creates a control for rendering the field on a New item form.

Namespace:  Microsoft.SharePoint.MobileControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

protected virtual MobileControl CreateControlForNew()

Return Value

Type: System.Web.UI.MobileControls.MobileControl
A MobileControl that renders the field on a New form.

The default implementation calls CreateControlForDisplay.

The following example shows an override of this method that inserts default text in the item title on a New item form. For the full example, see Walkthrough: Creating a Custom Field Rendering Control for Mobile Pages.

protected override MobileControl CreateControlForNew()
{
    MobileControl myNewControl = null;
    if (this.Field != null)
    {
        string text = "Group: Project Name";
        if (!this.Page.IsPostBack)
        {
            this.TextBoxControl.Text = text;
        }
        myNewControl = this.TextBoxControl;
    }
    return myNewControl;
}
Show:
© 2015 Microsoft