共用方式為


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)

Syntax

Protected Overridable Function CreateControlForNew As MobileControl

Dim returnValue As MobileControl

returnValue = Me.CreateControlForNew()
protected virtual MobileControl CreateControlForNew()

Return Value

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

Remarks

The default implementation calls CreateControlForDisplay.

Examples

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.

C#

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;

}

See Also

Reference

SPMobileBaseFieldControl Class

SPMobileBaseFieldControl Members

Microsoft.SharePoint.MobileControls Namespace