Cette documentation est archivée et n’est pas conservée.

SPMobileBaseFieldControl.CreateControlForEdit, méthode (Microsoft.SharePoint.MobileControls)

Windows SharePoint Services 3
Creates a control for rendering the field on an Edit item form.

Espace de noms : Microsoft.SharePoint.MobileControls
Assembly : Microsoft.SharePoint (dans microsoft.sharepoint.dll)

protected virtual MobileControl CreateControlForEdit ()

Valeur retournée

A MobileControl that renders the field on an Edit form.

The default implementation calls CreateControlForDisplay.

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 Procédure pas à pas : créer un contrôle de rendu de champ personnalisé pour les pages mobiles.

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;
}
Afficher: