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

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

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

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

protected virtual MobileControl CreateControlForDisplay ()

Valeur retournée

A MobileControl that renders the field on a Display form.

The default implementation calls CreateControlForView.

The following example shows an override of CreateControlForDisplay that adds a search text box after the item title on a Display 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 CreateControlForDisplay()
{
   string title = Convert.ToString(this.ItemFieldValue);
   if (!String.IsNullOrEmpty(title))
   {
      this.LabelControl.BreakAfter = false;
      this.LabelControl.Text = title + " ";

      this.LinkControl.BreakAfter = false;
      this.LinkControl.Text = "Search";
      this.LinkControl.NavigateUrl = "http://search.msn.com/results.aspx?q=" + title.Replace(' ', '+');

      Panel panel = new Panel();
      panel.BreakAfter = false;
      panel.Controls.Add(this.LabelControl);
      panel.Controls.Add(this.LinkControl);

      return panel;
   }
   return null;
}
Afficher: