Aracılığıyla paylaş


ProxyWebPartManager.StaticConnections Özellik

Tanım

İçerik sayfasındaki öğesi içinde <asp:proxywebpartmanager> bildirilen statik bağlantılar koleksiyonunu alır.

public:
 property System::Web::UI::WebControls::WebParts::ProxyWebPartConnectionCollection ^ StaticConnections { System::Web::UI::WebControls::WebParts::ProxyWebPartConnectionCollection ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public System.Web.UI.WebControls.WebParts.ProxyWebPartConnectionCollection StaticConnections { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.StaticConnections : System.Web.UI.WebControls.WebParts.ProxyWebPartConnectionCollection
Public ReadOnly Property StaticConnections As ProxyWebPartConnectionCollection

Özellik Değeri

ProxyWebPartConnectionCollection

Bir ProxyWebPartConnectionCollection öğe içinde bildirilen tüm statik WebPartConnection nesneleri içeren.<asp:proxywebpartmanager>

Öznitelikler

Örnekler

Aşağıdaki kod örneği, sınıfında özelliğinin StaticConnections ProxyWebPartManager nasıl kullanılacağını gösterir. Bu kod örneği, içerik sayfasındaki kodun yalnızca denetimi ve statik bağlantıyı bildiren ProxyWebPartManager ilgili bölümünü gösterir. Kod örneğini çalıştırmak için gereken diğer sayfalar ve bunların nasıl ayarlanacağına ilişkin bir açıklama için, sınıfa genel bakışın ProxyWebPartManager Örnek bölümüne bakın.

Aşağıdaki kod, öğesini öğenin alt öğesi olarak bildiren <staticconnections> içerik sayfasıdır <asp:proxywebpartmanager> . Ayrıca yönteminin Button1_Click denetimdeki ProxyWebPartManager özelliğin StaticConnections sayısını denetlediğini ve sayfaya yazdığını unutmayın.

<%@ Page Language="C#" MasterPageFile="~/MasterPageCS.master" 
  Title="Connections Page" %>
<%@ Register TagPrefix="aspSample" 
    Namespace="Samples.AspNet.CS.Controls" %>

<script runat="server">

  protected void Button1_Click(object sender, EventArgs e)
  {
    StringBuilder lblText = new StringBuilder();
    
    if (Page.Master.FindControl("WebPartManager1") != null)
    {
      WebPartManager theMgr = 
        (WebPartManager)Page.Master.FindControl("WebPartManager1");
      lblText.Append("WebPartManager:  <br /><pre>" +
        "  Master page file is " + Page.MasterPageFile + "<br />" +
        "  ID is " + theMgr.ID + "<br />" +
        "  Connection count is " +
           theMgr.StaticConnections.Count.ToString() + "<br />" +
        "  WebParts count is " +
           theMgr.WebParts.Count.ToString() + "</pre><br />");
    }

    if (proxymgr1 != null)
    {
      lblText.Append("ProxyWebPartManager:  <br /><pre>" +
        "  Content page file is " + Request.Path + "<br />" +
        "  ID is " + proxymgr1.ID + "<br />" +
        "  Connection count is " +
           proxymgr1.StaticConnections.Count.ToString() + 
           "</pre><br />");
    }

    Literal1.Text = lblText.ToString();
    
  }
  
</script>

<asp:Content ID="Content1" Runat="Server" 
  ContentPlaceHolderID="ContentPlaceHolder1" >
 
  <asp:proxywebpartmanager id="proxymgr1" runat="server">
    <staticconnections>
      <asp:webpartconnection id="connection1" 
        consumerconnectionpointid="ZipCodeConsumer"
        consumerid="zipConsumer"
        providerconnectionpointid="ZipCodeProvider" 
        providerid="zipProvider" />
    </staticconnections>    
  </asp:proxywebpartmanager>

  <div>
  <asp:webpartzone id="zone1" runat="server">
    <zonetemplate>
      <aspsample:zipcodewebpart id="zipProvider" runat="server" 
        title="Zip Code Provider"  />
      <aspsample:weatherwebpart id="zipConsumer" runat="server" 
        title="Zip Code Consumer" />
    </zonetemplate>
  </asp:webpartzone>
  </div>
  
  <div>
  <asp:button id="Button1" runat="server" 
    text="WebPartManager Information" onclick="Button1_Click" />
  <br />
  
  </div>
  
  <asp:connectionszone id="ConnectionsZone1" runat="server" />
  <asp:literal id="Literal1" runat="server" />

</asp:Content>
<%@ Page Language="VB" MasterPageFile="~/MasterPageVB.master" 
  Title="Connections Page" %>
<%@ Register TagPrefix="aspSample" 
    Namespace="Samples.AspNet.VB.Controls" %>

<script runat="server">

  Protected Sub Button1_Click(ByVal sender As Object, _
    ByVal e As EventArgs)

    Dim lblText As StringBuilder = New StringBuilder()

    If Not (Page.Master.FindControl("WebPartManager1") Is Nothing) Then
      Dim theMgr As WebPartManager = _
        CType(Page.Master.FindControl("WebPartManager1"), WebPartManager)
      lblText.Append("WebPartManager:  <br /><pre>" & _
        "  Master page file is " & Page.MasterPageFile & "<br />" & _
        "  ID is " & theMgr.ID & "<br />" & _
        "  Connection count is " & _
           theMgr.StaticConnections.Count.ToString() & "<br />" & _
        "  WebParts count is " & _
           theMgr.WebParts.Count.ToString() & "</pre><br />")
    End If

    If Not (proxymgr1 Is Nothing) Then
      lblText.Append("ProxyWebPartManager:  <br /><pre>" & _
        "  Content page file is " & Request.Path & "<br />" & _
        "  ID is " & proxymgr1.ID & "<br />" & _
        "  Connection count is " & _
           proxymgr1.StaticConnections.Count.ToString() & "</pre><br />")
    End If

    Literal1.Text = lblText.ToString()
    
  End Sub

</script>

<asp:Content ID="Content1" Runat="Server" 
  ContentPlaceHolderID="ContentPlaceHolder1" >

  <asp:proxywebpartmanager id="proxymgr1" runat="server">
    <staticconnections>
      <asp:webpartconnection id="connection1" 
        consumerconnectionpointid="ZipCodeConsumer"
        consumerid="zipConsumer"
        providerconnectionpointid="ZipCodeProvider" 
        providerid="zipProvider" />
    </staticconnections>    
  </asp:proxywebpartmanager>

  <div>
  <asp:webpartzone id="zone1" runat="server">
    <zonetemplate>
      <aspsample:zipcodewebpart id="zipProvider" runat="server" 
        title="Zip Code Provider"  />
      <aspsample:weatherwebpart id="zipConsumer" runat="server" 
        title="Zip Code Consumer" />
    </zonetemplate>
  </asp:webpartzone>
  </div>
  
  <div>
  <asp:button id="Button1" runat="server" 
    text="WebPartManager Information" onclick="Button1_Click" />
  <br />
  <asp:literal id="Literal1" runat="server" />
  </div>
  
  <asp:connectionszone id="ConnectionsZone1" runat="server" />
  
</asp:Content>

Sayfayı bir tarayıcıda yükledikten sonra WebPartManager Bilgileri düğmesine tıklayın ve ana sayfadaki denetimle ilgili WebPartManager bilgileri ve ProxyWebPartManager içerik sayfasındaki denetimi gözlemleyin. Örneğin, her ikisinin de statik bağlantıları (özelliği) izleyen ilgili özelliklerinde aynı sayıya StaticConnections sahip olduğunu unutmayın.

Açıklamalar

özelliği, StaticConnections bir <asp:proxywebpartmanager> öğede bildirilen nesne koleksiyonuna WebPartConnection başvurur. Bu koleksiyonda yer alan bağlantılar denetimlerin statik bağlantılarına WebPartManager eklenir (koleksiyonu tarafından WebPartManager.StaticConnections başvurulur) ve denetimle WebPartManager ilişkilendirilmiş diğer bağlantılar gibi işlenir.

özelliğine StaticConnections karşılık gelen bildirim temelli öğe öğesidir <staticconnections> . Ana sayfaları kullanan bir uygulamada, <staticconnections> öğesi içerik sayfasındaki öğenin alt <asp:proxywebpartmanager> öğesi olarak eklenir ve <asp:webpartconnection> öğe de öğenin alt <staticconnections> öğesi olarak eklenir. Bir <staticconnections> öğeye birden çok <asp:webpartconnection> öğe eklenebilir ve birden çok içerik sayfası bir ana sayfa uygulamasının parçası olarak statik bağlantılar bildirebilir.

Şunlara uygulanır

Ayrıca bkz.