GenericWebPart.ChildControl Proprietà

Definizione

Ottiene un riferimento al controllo figlio di cui è stato eseguito il wrapping in un controllo GenericWebPart in fase di esecuzione.

public:
 property System::Web::UI::Control ^ ChildControl { System::Web::UI::Control ^ get(); };
public System.Web.UI.Control ChildControl { get; }
member this.ChildControl : System.Web.UI.Control
Public ReadOnly Property ChildControl As Control

Valore della proprietà

Un oggetto Control che fa riferimento al controllo figlio di cui è stato eseguito il wrapping.

Esempio

Nell'esempio di codice seguente viene illustrato l'uso a livello di codice della ChildControl proprietà. La ChildControl proprietà è accessibile a livello di codice per recuperare informazioni sul controllo figlio di un GenericWebPart controllo. Il codice sorgente completo per l'esempio è disponibile nella sezione Esempio dell'argomento GenericWebPart di panoramica.

protected void Button1_Click(object sender, EventArgs e)
{

  Label2.Text =
    @"<h3>Calendar GenericWebPart Properties</h3>" +
    "<em>Title: </em>" + calendarPart.Title +
    "<br />" +
    "<em>CatalogIconImageUrl:  </em>" + calendarPart.CatalogIconImageUrl +
    "<br />" +
    "<em>TitleUrl: </em>" + calendarPart.TitleUrl +
    "<br />" +
    "<em>Decription: </em>" + calendarPart.Description +
    "<br />" +
    "<em>TitleIconImageUrl: </em>" + calendarPart.TitleIconImageUrl +
    "<br />" +
    "<em>ChildControl ID: </em>" + calendarPart.ChildControl.ID +
    "<br />" +
    "<em>ChildControl Type: </em>" + calendarPart.ChildControl.GetType().Name +
    "<br />" +
    "<em>GenericWebPart ID: </em>" + calendarPart.ID +
    "<br />" +
    "<em>GenericWebPart Type: </em>" + calendarPart.GetType().Name +
    "<br />" +
    "<em>GenericWebPart Parent ID: </em>" + calendarPart.Parent.ID;

  Label3.Text =
    @"<h3>BulletedList GenericWebPart Properties</h3>" +
    "<em>Title: </em>" + listPart.Title +
    "<br />" +
    "<em>CatalogIconImageUrl:  </em>" + listPart.CatalogIconImageUrl +
    "<br />" +
    "<em>TitleUrl: </em>" + listPart.TitleUrl +
    "<br />" +
    "<em>Decription: </em>" + listPart.Description +
    "<br />" +
    "<em>TitleIconImageUrl: </em>" + listPart.TitleIconImageUrl +
    "<br />" +
    "<em>ChildControl ID: </em>" + listPart.ChildControl.ID +
    "<br />" +
    "<em>ChildControl Type: </em>" + listPart.ChildControl.GetType().Name +
    "<br />" +
    "<em>GenericWebPart ID: </em>" + listPart.ID +
    "<br />" +
    "<em>GenericWebPart Type: </em>" + listPart.GetType().Name +
    "<br />" +
    "<em>GenericWebPart Parent ID: </em>" + listPart.Parent.ID;
}
  Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)

    Label2.Text = _
      "<h3>Calendar GenericWebPart Properties</h3>" & _
      "<em>Title: </em>" & calendarPart.Title & _
      "<br />" & _
      "<em>CatalogIconImageUrl:  </em>" & calendarPart.CatalogIconImageUrl & _
      "<br />" & _
      "<em>TitleUrl: </em>" & calendarPart.TitleUrl & _
      "<br />" & _
      "<em>Decription: </em>" & calendarPart.Description & _
      "<br />" & _
      "<em>TitleIconImageUrl: </em>" & calendarPart.TitleIconImageUrl & _
      "<br />" & _
      "<em>ChildControl ID: </em>" & calendarPart.ChildControl.ID & _
      "<br />" & _
      "<em>ChildControl Type: </em>" & calendarPart.ChildControl.GetType().Name & _
      "<br />" & _
      "<em>GenericWebPart ID: </em>" & calendarPart.ID & _
      "<br />" & _
      "<em>GenericWebPart Type: </em>" & calendarPart.GetType().Name & _
      "<br />" & _
      "<em>GenericWebPart Parent ID: </em>" & calendarPart.Parent.ID

    Label3.Text = _
      "<h3>BulletedList GenericWebPart Properties</h3>" & _
      "<em>Title: </em>" & listPart.Title & _
      "<br />" & _
      "<em>CatalogIconImageUrl:  </em>" & listPart.CatalogIconImageUrl & _
      "<br />" & _
      "<em>TitleUrl: </em>" & listPart.TitleUrl & _
      "<br />" & _
      "<em>Decription: </em>" & listPart.Description & _
      "<br />" & _
      "<em>TitleIconImageUrl: </em>" & listPart.TitleIconImageUrl & _
      "<br />" & _
      "<em>ChildControl ID: </em>" & listPart.ChildControl.ID & _
      "<br />" & _
      "<em>ChildControl Type: </em>" & listPart.ChildControl.GetType().Name & _
      "<br />" & _
      "<em>GenericWebPart ID: </em>" & listPart.ID & _
      "<br />" & _
      "<em>GenericWebPart Type: </em>" & listPart.GetType().Name & _
      "<br />" & _
      "<em>GenericWebPart Parent ID: </em>" & listPart.Parent.ID
  End Sub

End Class

Commenti

La ChildControl proprietà fornisce i mezzi per accedere al controllo figlio eseguito da un GenericWebPart controllo. Ad esempio, il WebPartManager controllo usa la ChildControl proprietà per estrarre i dati di personalizzazione dal controllo figlio.

Si applica a

Vedi anche