ConnectionsZone 생성자

정의

ConnectionsZone 클래스의 새 인스턴스를 초기화합니다.

public:
 ConnectionsZone();
public ConnectionsZone ();
Public Sub New ()

예제

다음 코드 예제에서는 생성자를 사용하여 ConnectionsZone 프로그래밍 방식으로 웹 페이지에 추가할 컨트롤의 ConnectionsZone 새 인스턴스를 만드는 방법을 보여 줍니다. 이 예제에는 생성자의 사용을 보여 주는 웹 페이지의 코드만 포함됩니다. 예제를 실행하는 데 필요한 다른 두 코드 파일은 클래스 개요의 예제 섹션을 ConnectionsZone 참조하세요. 코드 예제에는 다음 네 부분이 있습니다.

  • 웹 페이지에서 표시 모드를 전환할 수 있는 사용자 컨트롤입니다. 클래스 개요에서 ConnectionsZone 이 코드를 가져옵니다.

  • 우편 번호 인터페이스에 대한 코드와 연결의 공급자 및 소비자 역할을 하는 두 개의 WebPart 컨트롤이 포함된 소스 파일입니다. 클래스 개요에서 ConnectionsZone 이 코드를 가져옵니다.

  • 모든 컨트롤을 호스트하고 해당 Page_Init 메서드에서 생성자를 사용하여 ConnectionsZone 컨트롤의 ConnectionsZone 새 인스턴스를 만들고 페이지에 추가하는 웹 페이지입니다.

  • 예제가 브라우저에서 작동하는 방식에 대한 설명입니다.

웹 페이지의 메서드에서 Page_Init 생성자를 사용하여 새 ConnectionsZone 컨트롤이 만들어지고 페이지에 추가됩니다. 사용자가 연결 모드로 페이지를 설정하고 컨트롤 중 WebPart 하나에서 연결 동사를 클릭하면 컨트롤이 ConnectionsZone 나타납니다.

<%@ Page Language="C#" %>
<%@ register tagprefix="uc1" 
    tagname="DisplayModeMenuCS"
    src="~/displaymodemenucs.ascx" %>
<%@ Register TagPrefix="aspSample" 
    Namespace="Samples.AspNet.CS.Controls" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
  protected void Page_Init(object sender, EventArgs e)
  {
    ConnectionsZone connZone = new ConnectionsZone();
    connZone.ID = "connectionsZone1";
    connZone.HeaderText = "Connections Zone 1";
    form1.Controls.AddAt(form1.Controls.Count - 1, connZone);
  }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Connection Zone Sample</title>
</head>
<body>
  <form id="form1" runat="server">
  <asp:webpartmanager runat="server" id="mgr">
    <staticconnections>
      <asp:webpartconnection id="connection1" 
        consumerconnectionpointid="ZipCodeConsumer"
        consumerid="zipConsumer"
        providerconnectionpointid="ZipCodeProvider" 
        providerid="zipProvider" />
    </staticconnections>
  </asp:webpartmanager>
  <uc1:displaymodemenucs id="menu1" runat="server" />
  <div>
  <asp:webpartzone id="WebPartZone1" 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>
  </form>
</body>
</html>
<%@ Page Language="VB" %>
<%@ register tagprefix="uc1" 
    tagname="DisplayModeMenuVB"
    src="~/displaymodemenuvb.ascx" %>
<%@ Register TagPrefix="aspSample" 
    Namespace="Samples.AspNet.VB.Controls" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

  Protected Sub Page_Init(ByVal sender As Object, _
    ByVal e As System.EventArgs)
    
    Dim connZone As ConnectionsZone = New ConnectionsZone()
    connZone.ID = "connectionsZone1"
    connZone.HeaderText = "Connections Zone 1"
    form1.Controls.AddAt(form1.Controls.Count - 1, connZone)

  End Sub
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Connection Zone Sample</title>
</head>
<body>
  <form id="form1" runat="server">
  <asp:webpartmanager runat="server" id="mgr">
    <staticconnections>
      <asp:webpartconnection id="connection1" 
        consumerconnectionpointid="ZipCodeConsumer"
        consumerid="zipConsumer"
        providerconnectionpointid="ZipCodeProvider" 
        providerid="zipProvider" />
    </staticconnections>
  </asp:webpartmanager>
  <uc1:displaymodemenuvb id="menu1" runat="server" />
  <div>
  <asp:webpartzone id="WebPartZone1" 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>
  </form>
</body>
</html>

브라우저에서 페이지를 로드 합니다. 디스플레이 모드 컨트롤을 사용하여 연결 모드로 전환합니다. 우편 번호 공급자 컨트롤에서 동사 메뉴 화살표를 클릭하고 연결 동사를 클릭합니다. 연결 UI가 나타나고 페이지의 태그에서 연결이 선언되었으므로 컨트롤이 이미 연결되어 있습니다.

설명

이 매개 변수가 없는 생성자는 ASP.NET 페이지에서 요소를 선언 <asp:connectionszone> 할 때 호출됩니다. 프로그래밍 방식으로 페이지에 컨트롤을 추가하는 경우를 제외하고 이 생성자를 암시적으로 호출할 필요가 없습니다.

적용 대상

추가 정보