Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
CreateControlForNew Method

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)

'Declaration
Protected Overridable Function CreateControlForNew As MobileControl
'Usage
Dim returnValue As MobileControl

returnValue = Me.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 Overrides Function CreateControlForNew() As MobileControl
    Dim myNewControl As MobileControl = Nothing
    If Me.Field IsNot Nothing Then
        Dim text As String = "Group: Project Name"
        If Not Me.Page.IsPostBack Then
            Me.TextBoxControl.Text = text
        End If
        myNewControl = Me.TextBoxControl
    End If
    Return myNewControl
End Function
Show:
© 2015 Microsoft