다음을 통해 공유


SPMobileBaseFieldControl.CreateControlForEdit Method

Creates a control for rendering the field on an Edit item form.

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

Syntax

Protected Overridable Function CreateControlForEdit As MobileControl

Dim returnValue As MobileControl

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

Return Value

Type: System.Web.UI.MobileControls.MobileControl
A MobileControl that renders the field on an Edit form.

Remarks

The default implementation calls CreateControlForDisplay.

Examples

The following example shows an override of CreateControlForEdit that adds an "OVERDUE" to the item title on an Edit item form. For the full example, see Walkthrough: Creating a Custom Field Rendering Control for Mobile Pages.

protected override MobileControl CreateControlForEdit()
{
   MobileControl myEditControl = null;
   if (this.Item != null && this.Field != null)
   {
      if (this.NeedEllipsisRendering)
      {
         myEditControl = this.CreateControlForDisplay();
      }
      else
      {
         if (!this.Page.IsPostBack)
         {
            string strEdit = this.Field.GetFieldValueForEdit(this.ItemFieldValue);
            string overDue = "OVERDUE: ";

            SPListItem item = this.ListItem;
            if (item["Expires"] != null)
            {
               System.DateTime date = (DateTime)item["Expires"];
               if (date.CompareTo(System.DateTime.Today) < 0)
               {
                  this.TextBoxControl.Text = overDue + strEdit;
               }
               else
               {
                  this.TextBoxControl.Text = strEdit;
               }
            }
         }
         myEditControl = this.TextBoxControl;
      }
   }
   return myEditControl;
}

See Also

Reference

SPMobileBaseFieldControl Class

SPMobileBaseFieldControl Members

Microsoft.SharePoint.MobileControls Namespace