ProxyWebPartManager Web Sunucusu Denetimi Tanımlayıcı Sözdizimi
WebPartManager denetimi içerik sayfasının ilişkili ana sayfasında bildirildiği zaman içerik sayfasındaki statik bağlantıları bildirmek için geliştiricilere bir yol sağlar.
<asp:ProxyWebPartManager
EnableTheming="True|False"
EnableViewState="True|False"
ID="string"
OnDataBinding="DataBinding event handler"
OnDisposed="Disposed event handler"
OnInit="Init event handler"
OnLoad="Load event handler"
OnPreRender="PreRender event handler"
OnUnload="Unload event handler"
runat="server"
SkinID="string"
Visible="True|False"
>
<StaticConnections>
<asp:WebPartConnection
ConsumerConnectionPointID="string"
ConsumerID="string"
ID="string"
ProviderConnectionPointID="string"
ProviderID="string">
<asp:RowToFieldTransformer
FieldName="string"/>
<asp:RowToParametersTransformer
ConsumerFieldNames="string"
ProviderFieldNames="string"/>
</asp:WebPartConnection>
</StaticConnections>
</asp:ProxyWebPartManager>
Açıklamalar
WebPartManager denetimi ana sayfada önceden bildirilmiş olduğunda, içerik sayfalarında statik bağlantı bildirme senaryosu için ProxyWebPartManager denetimi vardır.
ProxyWebPartManager ve Web Bölümleri denetimleri hakkında daha fazla bilgi için bkz. ASP.NET Web Bölümleri Denetimler.
Örnek
Aşağıdaki kod örneğinde, ProxyWebPartManager sınıfının ana sayfaları kullanan bir uygulama içindeki içerik sayfalarında statik bağlantı bildirmek için nasıl kullanıldığı gösterilmektedir.
@ Register yönergeleri ile tanımlanan kullanıcı denetimi ve özel denetim tanımları ve @ Page yönergesindeki MasterPageFile özelliği ile başvurulan ana sayfa tanımları için, ProxyWebPartManager sınıfına genel bakış içindeki "Örnek" kısmına bakın.
<%@ 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>
<%@ 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>