Compartir a través de


: SPMobileBaseFieldControl.CreateControlForEdit (Método) (Microsoft.SharePoint.MobileControls)

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

Espacio de nombres:
Ensamblado: Microsoft.SharePoint (in microsoft.sharepoint.dll)

Sintaxis

'Declaración
Protected Overridable Function CreateControlForEdit As MobileControl
'Uso
Dim returnValue As MobileControl

returnValue = Me.CreateControlForEdit
protected virtual MobileControl CreateControlForEdit ()

Valor devuelto

A MobileControl that renders the field on an Edit form.

Comentarios

The default implementation calls CreateControlForDisplay.

Ejemplo

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 Tutorial: creación de un control de representación de campos personalizado para páginas móviles.

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

Vea también

Referencia

SPMobileBaseFieldControl (Clase)
SPMobileBaseFieldControl (Miembros)
Microsoft.SharePoint.MobileControls (Espacio de nombres)