다음을 통해 공유


ListView.ItemPlaceholderID 속성

정의

ListView 컨트롤의 항목 자리 표시자에 대한 ID를 가져오거나 설정합니다.

public:
 virtual property System::String ^ ItemPlaceholderID { System::String ^ get(); void set(System::String ^ value); };
public virtual string ItemPlaceholderID { get; set; }
member this.ItemPlaceholderID : string with get, set
Public Overridable Property ItemPlaceholderID As String

속성 값

String

ListView 컨트롤의 항목 자리 표시자에 대한 ID입니다. 기본값은 "itemPlaceholder"입니다.

예외

지정된 ID가 null이거나 빈 문자열인 경우

예제

다음 예제에서는 컨트롤의 ItemPlaceholderID 항목 자리 표시자에 대 한 ID를 지정 하는 속성을 사용 하는 방법을 보여 옵니다 ListView .

<%@ Page language="C#" %>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head id="Head1" runat="server">
    <title>ListView GroupContainerID and ItemContainerID Example</title>
    <style type="text/css">
      body
      {
          font: 10pt Trebuchet MS, Arial, Tahoma; 
          text-align: center;
      }
      th { background: #b7cfff; }
      .item
      {
          border: 1px dashed #a4cbf4;
          background: white;
          min-height: 19px;
          width: 33%;
      }
      .alternatingItem
      {
        border: solid 1px #a4cbf4;
        background: #edf5fd;
        width: 33%;
        min-height: 19px;
      }
    </style>
  </head>
  <body>
    <form id="form1" runat="server">

      <h3>ListView GroupContainerID and ItemContainerID Example</h3>
      
      <asp:ListView ID="ContactsListView" 
        DataSourceID="ContactsDataSource"
        GroupItemCount="3"
        GroupPlaceholderID="ContactRowContainer"
        ItemPlaceholderID="ContactItemContainer"
        runat="server">
        <LayoutTemplate>
          <table cellpadding="4" width="640px" runat="server" id="tblContacts">
            <tr runat="server">
              <th colspan="3" runat="server">Contacts</th>
            </tr>
            <tr runat="server" id="ContactRowContainer" />
          </table>
          <asp:DataPager ID="ContactsDataPager" runat="server" PageSize="30">
            <Fields>
              <asp:NumericPagerField ButtonCount="10" />
            </Fields>
          </asp:DataPager>
        </LayoutTemplate>
        <GroupTemplate>
          <tr runat="server" id="ContactRow">
            <td runat="server" id="ContactItemContainer" />
          </tr>
        </GroupTemplate>
        <ItemTemplate>
          <td class="item" runat="server">
            <asp:Label ID="NameLabel" runat="server" 
              Text='<%# Eval("LastName") + ", " + Eval("FirstName")%>' />
          </td>
        </ItemTemplate>
        <AlternatingItemTemplate>
          <td class="alternatingItem" runat="server">
            <asp:Label ID="NameLabel" runat="server" 
              Text='<%# Eval("LastName") + ", " + Eval("FirstName")%>' />
          </td>
        </AlternatingItemTemplate>
      </asp:ListView>
      
      <!-- This example uses Microsoft SQL Server and connects      -->
      <!-- to the AdventureWorks sample database. Use an ASP.NET    -->
      <!-- expression to retrieve the connection string value       -->
      <!-- from the Web.config file.                                -->      
      <asp:SqlDataSource ID="ContactsDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"
        SelectCommand="SELECT [FirstName], [LastName] 
          FROM Person.Contact ORDER BY [LastName], [FirstName] ">
      </asp:SqlDataSource>

    </form>
  </body>
</html>
<%@ Page language="VB" %>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head id="Head1" runat="server">
    <title>ListView GroupContainerID and ItemContainerID Example</title>
    <style type="text/css">
      body
      {
          font: 10pt Trebuchet MS, Arial, Tahoma; 
          text-align: center;
      }
      th { background: #b7cfff; }
      .item
      {
          border: 1px dashed #a4cbf4;
          background: white;
          min-height: 19px;
          width: 33%;
      }
      .alternatingItem
      {
        border: solid 1px #a4cbf4;
        background: #edf5fd;
        width: 33%;
        min-height: 19px;
      }
    </style>
  </head>
  <body>
    <form id="form1" runat="server">

      <h3>ListView GroupContainerID and ItemContainerID Example</h3>
      
      <asp:ListView ID="ContactsListView" 
        DataSourceID="ContactsDataSource"
        GroupItemCount="3"
        GroupPlaceholderID="ContactRowContainer"
        ItemPlaceholderID="ContactItemContainer"
        runat="server">
        <LayoutTemplate>
          <table cellpadding="4" width="640px" runat="server" id="tblContacts">
            <tr id="Tr1" runat="server">
              <th id="Th1" colspan="3" runat="server">Contacts</th>
            </tr>
            <tr runat="server" id="ContactRowContainer" />
          </table>
          <asp:DataPager ID="ContactsDataPager" runat="server" PageSize="30">
            <Fields>
              <asp:NumericPagerField ButtonCount="10" />
            </Fields>
          </asp:DataPager>
        </LayoutTemplate>
        <GroupTemplate>
          <tr runat="server" id="ContactRow">
            <td runat="server" id="ContactItemContainer" />
          </tr>
        </GroupTemplate>
        <ItemTemplate>
          <td id="Td1" class="item" runat="server">
            <asp:Label ID="NameLabel" runat="server" 
              Text='<%# Eval("LastName") & ", " & Eval("FirstName")%>' />
          </td>
        </ItemTemplate>
        <AlternatingItemTemplate>
          <td id="Td2" class="alternatingItem" runat="server">
            <asp:Label ID="NameLabel" runat="server" 
              Text='<%# Eval("LastName") & ", " & Eval("FirstName")%>' />
          </td>
        </AlternatingItemTemplate>
      </asp:ListView>
      
      <!-- This example uses Microsoft SQL Server and connects      -->
      <!-- to the AdventureWorks sample database. Use an ASP.NET    -->
      <!-- expression to retrieve the connection string value       -->
      <!-- from the Web.config file.                                -->      
      <asp:SqlDataSource ID="ContactsDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"
        SelectCommand="SELECT [FirstName], [LastName] 
          FROM Person.Contact ORDER BY [LastName], [FirstName] ">
      </asp:SqlDataSource>

    </form>
  </body>
</html>

설명

ItemPlaceholderID 속성을 사용하여 항목 자리 표시자에 대한 ID를 지정합니다. 항목 자리 표시자는 항목을 렌더링할 위치를 나타내기 위해 LayoutTemplate GroupTemplate 템플릿(그룹을 사용하지 않는 경우) 또는 템플릿(그룹을 사용하는 경우)에 추가하는 컨트롤입니다.

적용 대상

추가 정보