ListView ListView ListView ListView Class

定義

以使用者定義的樣板顯示資料來源的值。Displays the values of a data source by using user-defined templates. ListView 控制項可讓使用者選取、排序、刪除、編輯和插入資料錄。The ListView control enables users to select, sort, delete, edit, and insert records.

public ref class ListView : System::Web::UI::WebControls::DataBoundControl, System::Web::UI::IDataKeysControl, System::Web::UI::INamingContainer, System::Web::UI::WebControls::IDataBoundListControl, System::Web::UI::WebControls::IPageableItemContainer, System::Web::UI::WebControls::IPersistedSelector
[System.Drawing.ToolboxBitmap(typeof(System.Web.UI.WebControls.ListView), "ListView.bmp")]
[System.Web.UI.ControlValueProperty("SelectedValue")]
[System.Drawing.ToolboxBitmap(typeof(System.Web.UI.WebControls.ListView), "ListView.ico")]
public class ListView : System.Web.UI.WebControls.DataBoundControl, System.Web.UI.IDataKeysControl, System.Web.UI.INamingContainer, System.Web.UI.WebControls.IDataBoundListControl, System.Web.UI.WebControls.IPageableItemContainer, System.Web.UI.WebControls.IPersistedSelector
type ListView = class
    inherit DataBoundControl
    interface INamingContainer
    interface IPageableItemContainer
    interface IPersistedSelector
    interface IDataKeysControl
    interface IDataBoundListControl
    interface IDataBoundControl
Public Class ListView
Inherits DataBoundControl
Implements IDataBoundListControl, IDataKeysControl, INamingContainer, IPageableItemContainer, IPersistedSelector
繼承
屬性
實作

範例

下列範例示範如何使用ListView控制項, 利用 HTML 資料表來顯示資料庫中的記錄。The following example shows how to use the ListView control to display records from a database by using an HTML table. 系統會使用LinqDataSource控制項來抓取這些值。The values are retrieved by using a LinqDataSource control.

<%@ 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 Example</title>
  </head>
  <body>
    <form id="form1" runat="server">
        
      <h3>ListView Example</h3>
                       
      <asp:ListView ID="VendorsListView"
        DataSourceID="VendorsDataSource"
        DataKeyNames="VendorID"
        runat="server">
        <LayoutTemplate>
          <table cellpadding="2" width="640px" border="1" ID="tbl1" runat="server">
            <tr runat="server" style="background-color: #98FB98">
              <th runat="server">ID</th>
              <th runat="server">Account Number</th>
              <th runat="server">Name</th>
              <th runat="server">Preferred Vendor</th>
            </tr>
            <tr runat="server" id="itemPlaceholder" />
          </table>
          <asp:DataPager ID="DataPager1" runat="server">
            <Fields>
              <asp:NumericPagerField />
            </Fields>
          </asp:DataPager>
        </LayoutTemplate>
        <ItemTemplate>
          <tr runat="server">
            <td>
              <asp:Label ID="VendorIDLabel" runat="server" Text='<%# Eval("VendorID") %>' />
            </td>
            <td>
              <asp:Label ID="AccountNumberLabel" runat="server" Text='<%# Eval("AccountNumber") %>' />
            </td>
            <td>
              <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' /></td>
            <td>
              <asp:CheckBox ID="PreferredCheckBox" runat="server" 
                Checked='<%# Eval("PreferredVendorStatus") %>' Enabled="False" />
            </td>
          </tr>
        </ItemTemplate>
      </asp:ListView>

      <!-- This example uses Microsoft SQL Server and connects   -->
      <!-- to the AdventureWorks sample database. Add a LINQ     -->
      <!-- to SQL class to the project to map to a table in      -->
      <!-- the database.                                         -->
      <asp:LinqDataSource ID="VendorsDataSource" runat="server" 
        ContextTypeName="AdventureWorksClassesDataContext" 
        Select="new (VendorID, AccountNumber, Name, PreferredVendorStatus)" 
        TableName="Vendors" Where="ActiveFlag == @ActiveFlag">
        <WhereParameters>
          <asp:Parameter DefaultValue="true" Name="ActiveFlag" Type="Boolean" />
        </WhereParameters>
      </asp:LinqDataSource>
      
    </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 Example</title>
  </head>
  <body>
    <form id="form1" runat="server">
        
      <h3>ListView Example</h3>
                       
      <asp:ListView ID="VendorsListView"
        DataSourceID="VendorsDataSource"
        DataKeyNames="VendorID"
        runat="server">
        <LayoutTemplate>
          <table cellpadding="2" width="640px" border="1" ID="tbl1" runat="server">
            <tr runat="server" style="background-color: #98FB98">
              <th runat="server">ID</th>
              <th runat="server">Account Number</th>
              <th runat="server">Name</th>
              <th runat="server">Preferred Vendor</th>
            </tr>
            <tr runat="server" id="itemPlaceholder" />
          </table>
          <asp:DataPager ID="DataPager1" runat="server">
            <Fields>
              <asp:NumericPagerField />
            </Fields>
          </asp:DataPager>
        </LayoutTemplate>
        <ItemTemplate>
          <tr runat="server">
            <td>
              <asp:Label ID="VendorIDLabel" runat="server" Text='<%# Eval("VendorID") %>' />
            </td>
            <td>
              <asp:Label ID="AccountNumberLabel" runat="server" Text='<%# Eval("AccountNumber") %>' />
            </td>
            <td>
              <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' /></td>
            <td>
              <asp:CheckBox ID="PreferredCheckBox" runat="server" 
                Checked='<%# Eval("PreferredVendorStatus") %>' Enabled="False" />
            </td>
          </tr>
        </ItemTemplate>
      </asp:ListView>

      <!-- This example uses Microsoft SQL Server and connects   -->
      <!-- to the AdventureWorks sample database. Add a LINQ     -->
      <!-- to SQL class to the project to map to a table in      -->
      <!-- the database.                                         -->
      <asp:LinqDataSource ID="VendorsDataSource" runat="server" 
        ContextTypeName="AdventureWorksClassesDataContext" 
        Select="new (VendorID, AccountNumber, Name, PreferredVendorStatus)" 
        TableName="Vendors" Where="ActiveFlag == @ActiveFlag">
        <WhereParameters>
          <asp:Parameter DefaultValue="true" Name="ActiveFlag" Type="Boolean" />
        </WhereParameters>
      </asp:LinqDataSource>
      
    </form>
  </body>
</html>

下列範例示範如何使用ListView控制項, 以div使用專案來顯示流程版面配置中的值。The following example shows how to use the ListView control to display values in a flow layout by using the div element. 系統會使用SqlDataSource控制項來抓取這些值。The values are retrieved by using a SqlDataSource control.

<%@ 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 Flow Layout Example</title>
    <style type="text/css">
      .plainBox {
          font-family: Verdana, Arial, sans-serif;
          font-size: 11px;
          background: #ffffff;
          border:1px solid #336666;
          }
    </style>
  </head>
  <body>
    <form id="form1" runat="server">

      <h3>ListView Flow Layout Example</h3>
      
      Select the color:
      <asp:DropDownList ID="ColorList" runat="server" 
        AutoPostBack="True" 
        DataSourceID="ColorDataSource" 
        DataTextField="Color" 
        DataValueField="Color">
      </asp:DropDownList><br /><br />
      
      <asp:ListView runat="server" ID="ProductListView"
        DataSourceID="ProductsDataSource"
        DataKeyNames="ProductID">
        <LayoutTemplate>
          <div runat="server" id="lstProducts">
            <div runat="server" id="itemPlaceholder" />
          </div>
          <asp:DataPager runat="server" PageSize="5" >
            <Fields>
              <asp:NextPreviousPagerField 
                ButtonType="Button"
                ShowFirstPageButton="True" 
                ShowLastPageButton="True" />
            </Fields>
          </asp:DataPager>
        </LayoutTemplate>
        <ItemTemplate>
          <asp:Image ID="ProductImage" runat="server"
            ImageUrl='<%# "~/images/thumbnails/" + Eval("ThumbnailPhotoFileName") %>' />	        
          <div class="plainBox" runat="server">
            <asp:HyperLink ID="ProductLink" runat="server" Text='<%# Eval("Name") %>' 
              NavigateUrl='<%# "ProductDetails.aspx?productID=" + Eval("ProductID") %>' />
            <br /><br />
            <b>Price:</b> 
            <asp:Label ID="PriceLabel" runat="server" Text='<%# Eval("ListPrice", "{0:c}")%>' /> <br />
          </div>
          <br />
        </ItemTemplate>
      </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="ProductsDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"            	        
        SelectCommand="SELECT P.ProductID, P.Name, P.Color, P.ListPrice, 
          PF.ThumbnailPhotoFileName, P.Size
          FROM Production.Product AS P 
          INNER JOIN Production.ProductProductPhoto AS PPF ON P.ProductID = PPF.ProductID 
          INNER JOIN Production.ProductPhoto AS PF ON PPF.ProductPhotoID = PF.ProductPhotoID
          WHERE P.Color = @Color" >
        <SelectParameters>
          <asp:ControlParameter ControlID="ColorList" Name="Color" 
            PropertyName="SelectedValue" />
        </SelectParameters>
      </asp:SqlDataSource>

      <asp:SqlDataSource ID="ColorDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>" 
        SelectCommand="SELECT DISTINCT Color FROM Production.Product">
      </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 Flow Layout Example</title>
    <style type="text/css">
      .plainBox {
          font-family: Verdana, Arial, sans-serif;
          font-size: 11px;
          background: #ffffff;
          border:1px solid #336666;
          }
    </style>
  </head>
  <body>
    <form id="form1" runat="server">

      <h3>ListView Flow Layout Example</h3>
      
      Select the color:
      <asp:DropDownList ID="ColorList" runat="server" 
        AutoPostBack="True" 
        DataSourceID="ColorDataSource" 
        DataTextField="Color" 
        DataValueField="Color">
      </asp:DropDownList><br /><br />
      
      <asp:ListView runat="server" ID="ProductListView"
        DataSourceID="ProductsDataSource"
        DataKeyNames="ProductID">
        <LayoutTemplate>
          <div runat="server" id="lstProducts">
            <div runat="server" id="itemPlaceholder" />
          </div>
          <asp:DataPager ID="DataPager1" runat="server" PageSize="5" >
            <Fields>
              <asp:NextPreviousPagerField 
                ButtonType="Button"
                ShowFirstPageButton="True" 
                ShowLastPageButton="True" />
            </Fields>
          </asp:DataPager>
        </LayoutTemplate>
        <ItemTemplate>
          <asp:Image ID="ProductImage" runat="server"
            ImageUrl='<%# "~/images/thumbnails/" & Eval("ThumbnailPhotoFileName") %>' />	        
          <div class="plainBox" runat="server">
            <asp:HyperLink ID="ProductLink" runat="server" Text='<%# Eval("Name") %>' 
              NavigateUrl='<%# "ProductDetails.aspx?productID=" & Eval("ProductID") %>' />
            <br /><br />
            <b>Price:</b> 
            <asp:Label ID="PriceLabel" runat="server" Text='<%# Eval("ListPrice", "{0:c}")%>' /> <br />
          </div>
          <br />
        </ItemTemplate>
      </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="ProductsDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"            	        
        SelectCommand="SELECT P.ProductID, P.Name, P.Color, P.ListPrice, 
          PF.ThumbnailPhotoFileName, P.Size
          FROM Production.Product AS P 
          INNER JOIN Production.ProductProductPhoto AS PPF ON P.ProductID = PPF.ProductID 
          INNER JOIN Production.ProductPhoto AS PF ON PPF.ProductPhotoID = PF.ProductPhotoID
          WHERE P.Color = @Color" >
        <SelectParameters>
          <asp:ControlParameter ControlID="ColorList" Name="Color" 
            PropertyName="SelectedValue" />
        </SelectParameters>
      </asp:SqlDataSource>

      <asp:SqlDataSource ID="ColorDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>" 
        SelectCommand="SELECT DISTINCT Color FROM Production.Product">
      </asp:SqlDataSource>

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

下列範例顯示如何使用ListView控制項來插入、刪除和更新記錄。The following example shows how to use the ListView control to insert, delete, and update records.

重要

這個範例有一個可接受使用者輸入的文字方塊,這可能會造成安全性威脅。This example has a text box that accepts user input, which is a potential security threat. 根據預設,ASP.NET Web 網頁會驗證使用者輸入未包含指令碼或 HTML 項目。By default, ASP.NET Web pages validate that user input does not include script or HTML elements. 如需詳細資訊,請參閱 Script Exploits Overview (指令碼攻擊概觀)。For more information, see Script Exploits Overview.

<%@ 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 Example</title>
    <style type="text/css">
        .EditItem { background-color:#8FBC8F;}
        .SelectedItem {	background-color:#9ACD32; }
        .InsertItem { background-color:#FFFACD;}
    </style>
  </head>
  <body>
    <form id="form1" runat="server">
        
      <h3>ListView Example</h3>
      
      <h5>Departments</h5>

      <asp:ListView ID="DepartmentsListView" 
        DataSourceID="DepartmentsDataSource" 
        DataKeyNames="DepartmentID"
        ConvertEmptyStringToNull="true"
        InsertItemPosition="LastItem"
        runat="server">
        <LayoutTemplate>
          <table cellpadding="2" runat="server" id="tblDepartments" width="640px" cellspacing="0">
            <tr runat="server" id="itemPlaceholder" />
          </table>
        </LayoutTemplate>
        <ItemTemplate>
          <tr runat="server">
            <td>
              <asp:Button ID="SelectButton" runat="server" Text="Select" CommandName="Select" />
              <asp:Button ID="EditButton" runat="server" Text="Edit" CommandName="Edit" />
            </td>
            <td>
              <asp:Label ID="IDLabel" runat="server" Text='<%#Eval("DepartmentID") %>' />
            </td>
            <td>
              <asp:Label ID="NameLabel" runat="server" Text='<%#Eval("Name") %>' />
            </td>
            <td>
              <asp:Label ID="GroupNameLabel" runat="server" Text='<%#Eval("GroupName") %>' />
            </td>
          </tr>
        </ItemTemplate>
        <SelectedItemTemplate>
          <tr class="SelectedItem" runat="server">
            <td>
              <asp:Button ID="DeleteButton" runat="server" Text="Delete" CommandName="Delete" />
              <asp:Button ID="EditButton" runat="server" Text="Edit" CommandName="Edit" />
            </td>
            <td>
              <asp:Label ID="IDLabel" runat="server" Text='<%#Eval("DepartmentID") %>' />
            </td>
            <td>
              <asp:Label ID="NameLabel" runat="server" Text='<%#Eval("Name") %>' />
            </td>
            <td>
              <asp:Label ID="GroupNameLabel" runat="server" Text='<%#Eval("GroupName") %>' />
            </td>
          </tr>
        </SelectedItemTemplate>
        <EditItemTemplate>
          <tr class="EditItem">
            <td>
              <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
              <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
            </td>
            <td>
              <b>ID</b><br />
              <asp:Label ID="IDLabel" runat="server" Text='<%#Eval("DepartmentID") %>' />
            </td>
            <td>
              <asp:Label runat="server" ID="NameLabel" AssociatedControlID="NameTextBox" 
                Text="Name" Font-Bold="true"/><br />
              <asp:TextBox ID="NameTextBox" runat="server" Text='<%#Bind("Name") %>' />
            </td>
            <td>
              <asp:Label runat="server" ID="GroupNameLabel" AssociatedControlID="GroupNameTextBox" 
                Text="Group Name" Font-Bold="true" /><br />
              <asp:TextBox ID="GroupNameTextBox" runat="server" 
                Width="200px"
                Text='<%#Bind("GroupName") %>' />
              <br />
            </td>
          </tr>
        </EditItemTemplate>
        <InsertItemTemplate>
          <tr class="InsertItem">
            <td colspan="2">
              <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" />
              <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
            </td>
            <td>
              <asp:Label runat="server" ID="NameLabel" AssociatedControlID="NameTextBox" 
                Text="Name" Font-Bold="true"/><br />
              <asp:TextBox ID="NameTextBox" runat="server" Text='<%#Bind("Name") %>' /><br />
            </td>
            <td>
              <asp:Label runat="server" ID="GroupNameLabel" AssociatedControlID="GroupNameTextBox" 
                Text="Group Name" Font-Bold="true" /><br />                
              <asp:TextBox ID="GroupNameTextBox" runat="server" Text='<%#Bind("GroupName") %>' />
            </td>
          </tr>
        </InsertItemTemplate>
      </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="DepartmentsDataSource" runat="server" 
            ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"
            SelectCommand="SELECT DepartmentID, Name, GroupName FROM HumanResources.Department"
            UpdateCommand="UPDATE HumanResources.Department 
                SET Name = @Name, GroupName = @GroupName WHERE (DepartmentID = @DepartmentID)"            
	        DeleteCommand="DELETE FROM HumanResources.Department 
	            WHERE (DepartmentID = @DepartmentID)" 
	        InsertCommand="INSERT INTO HumanResources.Department(Name, GroupName) 
	            VALUES (@Name, @GroupName)">
      </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 Example</title>
    <style type="text/css">
        .EditItem { background-color:#8FBC8F;}
        .SelectedItem {	background-color:#9ACD32; }
        .InsertItem { background-color:#FFFACD;}
    </style>
  </head>
  <body>
    <form id="form1" runat="server">
        
      <h3>ListView Example</h3>
      
      <h5>Departments</h5>

      <asp:ListView ID="DepartmentsListView" 
        DataSourceID="DepartmentsDataSource" 
        DataKeyNames="DepartmentID"
        ConvertEmptyStringToNull="true"
        InsertItemPosition="LastItem"
        runat="server">
        <LayoutTemplate>
          <table cellpadding="2" runat="server" id="tblDepartments" width="640px" cellspacing="0">
            <tr runat="server" id="itemPlaceholder" />
          </table>
        </LayoutTemplate>
        <ItemTemplate>
          <tr runat="server">
            <td>
              <asp:Button ID="SelectButton" runat="server" Text="Select" CommandName="Select" />
              <asp:Button ID="EditButton" runat="server" Text="Edit" CommandName="Edit" />
            </td>
            <td>
              <asp:Label ID="IDLabel" runat="server" Text='<%#Eval("DepartmentID") %>' />
            </td>
            <td>
              <asp:Label ID="NameLabel" runat="server" Text='<%#Eval("Name") %>' />
            </td>
            <td>
              <asp:Label ID="GroupNameLabel" runat="server" Text='<%#Eval("GroupName") %>' />
            </td>
          </tr>
        </ItemTemplate>
        <SelectedItemTemplate>
          <tr class="SelectedItem" runat="server">
            <td>
              <asp:Button ID="DeleteButton" runat="server" Text="Delete" CommandName="Delete" />
              <asp:Button ID="EditButton" runat="server" Text="Edit" CommandName="Edit" />
            </td>
            <td>
              <asp:Label ID="IDLabel" runat="server" Text='<%#Eval("DepartmentID") %>' />
            </td>
            <td>
              <asp:Label ID="NameLabel" runat="server" Text='<%#Eval("Name") %>' />
            </td>
            <td>
              <asp:Label ID="GroupNameLabel" runat="server" Text='<%#Eval("GroupName") %>' />
            </td>
          </tr>
        </SelectedItemTemplate>
        <EditItemTemplate>
          <tr class="EditItem">
            <td>
              <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
              <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
            </td>
            <td>
              <b>ID</b><br />
              <asp:Label ID="IDLabel" runat="server" Text='<%#Eval("DepartmentID") %>' />
            </td>
            <td>
              <asp:Label runat="server" ID="NameLabel" AssociatedControlID="NameTextBox" 
                Text="Name" Font-Bold="true"/><br />
              <asp:TextBox ID="NameTextBox" runat="server" Text='<%#Bind("Name") %>' />
            </td>
            <td>
              <asp:Label runat="server" ID="GroupNameLabel" AssociatedControlID="GroupNameTextBox" 
                Text="Group Name" Font-Bold="true" /><br />
              <asp:TextBox ID="GroupNameTextBox" runat="server" 
                Width="200px"
                Text='<%#Bind("GroupName") %>' />
              <br />
            </td>
          </tr>
        </EditItemTemplate>
        <InsertItemTemplate>
          <tr class="InsertItem">
            <td colspan="2">
              <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" />
              <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
            </td>
            <td>
              <asp:Label runat="server" ID="NameLabel" AssociatedControlID="NameTextBox" 
                Text="Name" Font-Bold="true"/><br />
              <asp:TextBox ID="NameTextBox" runat="server" Text='<%#Bind("Name") %>' /><br />
            </td>
            <td>
              <asp:Label runat="server" ID="GroupNameLabel" AssociatedControlID="GroupNameTextBox" 
                Text="Group Name" Font-Bold="true" /><br />                
              <asp:TextBox ID="GroupNameTextBox" runat="server" Text='<%#Bind("GroupName") %>' />
            </td>
          </tr>
        </InsertItemTemplate>
      </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="DepartmentsDataSource" runat="server" 
            ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"
            SelectCommand="SELECT DepartmentID, Name, GroupName FROM HumanResources.Department"
            UpdateCommand="UPDATE HumanResources.Department 
                SET Name = @Name, GroupName = @GroupName WHERE (DepartmentID = @DepartmentID)"            
	        DeleteCommand="DELETE FROM HumanResources.Department 
	            WHERE (DepartmentID = @DepartmentID)" 
	        InsertCommand="INSERT INTO HumanResources.Department(Name, GroupName) 
	            VALUES (@Name, @GroupName)">
      </asp:SqlDataSource>
      
    </form>
  </body>
</html>

備註

本主題內容:In this topic:

簡介Introduction

ListView控制項是用來顯示資料來源中的值。The ListView control is used to display the values from a data source. 它與GridView控制項相似, 不同之處在于它會使用使用者定義的範本來顯示資料, 而不是使用資料欄欄位。It resembles the GridView control, except that it displays data by using user-defined templates instead of row fields. 建立自己的範本可讓您更有彈性地控制資料的顯示方式。Creating your own templates gives you more flexibility in controlling how the data is displayed.

本主題提供具有原始程式碼的 Visual Studio 專案:下載A Visual Studio project with source code is available to accompany this topic: Download.

ListView控制項支援下列功能:The ListView control supports the following features:

  • 支援系結至資料來源控制項SqlDataSource, 例如、 LinqDataSource和。 ObjectDataSourceSupport for binding to data source controls such as SqlDataSource, LinqDataSource, and ObjectDataSource.

  • 透過使用者定義的範本和樣式可自訂的外觀。Customizable appearance through user-defined templates and styles.

  • 內建的排序功能。Built-in sorting capabilities.

  • 內建的更新和刪除功能。Built-in update and delete capabilities.

  • 內建的插入功能。Built-in insert capabilities.

  • 使用DataPager控制項支援分頁功能。Support for paging capabilities by using a DataPager control.

  • 內建專案選取功能。Built-in item selection capabilities.

  • 以程式設計方式ListView存取物件模型, 以動態設定屬性、處理事件等等。Programmatic access to the ListView object model to dynamically set properties, handle events, and so on.

  • 多個索引鍵欄位。Multiple key fields.

若要瞭解 ASP.NET 中可用的其他資料繫結控制項, 請參閱資料系結的 Web 服務器控制項To learn about other data-bound controls that are available in ASP.NET, see Data-Bound Web Server Controls.

範本Templates

為了讓ListView控制項顯示內容, 您必須為控制項的不同部分建立範本。In order for the ListView control to display content, you must create templates for different parts of the control. ItemTemplate必要的。The ItemTemplate is required. 所有其他範本都是選擇性的。All other templates are optional. LayoutTemplate需要屬性。The LayoutTemplate property is not required.

不過, 您必須為設定控制項的模式建立範本。However, you must create a template for the mode in which the control is configured. 例如, ListView支援插入記錄的控制項必須InsertItemTemplate定義範本。For example, a ListView control that supports inserting records must have an InsertItemTemplate template defined. 下表列出您可以為ListView控制項建立的範本。The following table lists the templates that you can create for the ListView control.

範本類型Template type 說明Description
LayoutTemplate 定義容器物件 (例如tabledivspan元素) 的根範本, 其將包含ItemTemplateGroupTemplate範本中定義的內容。The root template that defines a container object, such as a table, div, or span element, that will contain the content defined in the ItemTemplate or GroupTemplate template. 它也可能包含DataPager物件。It might also contain a DataPager object.
ItemTemplate 定義要針對個別專案顯示的資料系結內容。Defines the data-bound content to display for individual items.
ItemSeparatorTemplate 定義要在個別專案之間呈現的內容。Defines the content to render between individual items.
GroupTemplate 定義容器物件, 例如tr資料表資料列 ()、 divspan元素, ItemTemplate其中將包含和EmptyItemTemplate範本中定義的內容。Defines a container object, such as a table row (tr), div, or span element, that will contain the content defined in the ItemTemplate and EmptyItemTemplate templates. 群組中顯示的專案數是由GroupItemCount屬性所指定。The number of items that are displayed in a group is specified by the GroupItemCount property.
GroupSeparatorTemplate 定義要在專案群組之間呈現的內容。Defines the content to render between groups of items.
EmptyItemTemplate 定義使用GroupTemplate範本時, 要針對空白專案呈現的內容。Defines the content to render for an empty item when a GroupTemplate template is used. 例如, 如果GroupItemCount屬性設定為 5, 且從資料來源傳回的專案總數為 8, 則ListView控制項所顯示的最後一組資料將包含ItemTemplate範本所指定的三個專案, 以及兩個專案。如範本所EmptyItemTemplate指定。For example, if the GroupItemCount property is set to 5, and the total number of items returned from the data source is 8, the last group of data displayed by the ListView control will contain three items as specified by the ItemTemplate template, and two items as specified by the EmptyItemTemplate template.
EmptyDataTemplate 定義資料來源未傳回任何資料時要呈現的內容。Defines the content to render if the data source returns no data.
SelectedItemTemplate 定義要為選取資料項目呈現的內容, 以區別選取的專案與其他專案。Defines the content to render for the selected data item to differentiate the selected item from other items.
AlternatingItemTemplate 定義要針對替代專案轉譯的內容, 讓您更容易區別連續專案。Defines the content to render for alternating items to make it easier to distinguish between consecutive items.
EditItemTemplate 定義要在編輯專案時呈現的內容。Defines the content to render when an item is being edited. 範本會針對正在編輯之資料項目的範本進行轉譯。ItemTemplate EditItemTemplateThe EditItemTemplate template is rendered in place of the ItemTemplate template for the data item that is being edited.
InsertItemTemplate 定義要呈現以插入專案的內容。Defines the content to render to insert an item. InsertItemTemplate範本會在ListView控制項所顯示之ItemTemplate專案的開頭或結尾處, 用來取代範本。The InsertItemTemplate template is rendered in place of an ItemTemplate template at either the start or at the end of the items that are displayed by the ListView control. 您可以使用InsertItemTemplate ListView控制項的InsertItemPosition屬性, 指定轉譯範本的位置。You can specify where the InsertItemTemplate template is rendered by using the InsertItemPosition property of the ListView control.

若要顯示範本中欄位的值 (例如ItemTemplate), 您可以使用資料系結運算式。To display the value of a field in a template such as ItemTemplate, you use a data-binding expression. 如需資料系結運算式的詳細資訊, 請參閱資料系結運算式總覽For more information about data-binding expressions, see Data-Binding Expressions Overview.

若要將EditItemTemplateInsertItemTemplate範本中的輸入控制項系結至資料來源的欄位, 您可以使用雙向系結運算式。To bind input controls in the EditItemTemplate and InsertItemTemplate templates to fields of a data source, you can use two-way binding expressions. 這可讓ListView控制項自動將更新或插入作業的輸入控制項值解壓縮。This enables the ListView control to automatically extract the values of the input control for an update or insert operation. 雙向系結運算式也會啟用中EditItemTemplate的輸入控制項, 以自動顯示原始域值。Two-way binding expressions also enable input controls in an EditItemTemplate to automatically display the original field values. 如需雙向系結運算式的詳細資訊, 請參閱系結至資料庫For more information about two-way binding expressions, see Binding to Databases.

系結至資料來源Binding to a Data Source

您可以ListView將控制項系結至資料來源控制項 (例如SqlDataSource控制項或ObjectDataSource控制項), 或系結System.Collections.IEnumerable至任何執行介面的資料來源System.Data.DataView集合, 例如、 System.Collections.ArrayListSystem.Collections.Generic.List<T>或其他集合類型。You can bind the ListView control to a data source control (such as the SqlDataSource control or ObjectDataSource control) or to any data source collection that implements the System.Collections.IEnumerable interface, such as System.Data.DataView, System.Collections.ArrayList, System.Collections.Generic.List<T>, or other collection types. 使用下列其中一種方法, ListView將控制項系結至適當的資料來源類型:Use one of the following methods to bind the ListView control to the appropriate data source type:

  • 若要系結至資料來源控制項, 請DataSourceIDListView控制項的屬性設為ID資料來源控制項的值。To bind to a data source control, set the DataSourceID property of the ListView control to the ID value of the data source control. ListView控制項會自動系結至指定的資料來源控制項, 而且可以利用資料來源控制項的功能來執行排序、插入、更新、刪除和分頁功能。The ListView control automatically binds to the specified data source control and can take advantage of the data source control's capabilities to perform sorting, inserting, updating, deleting, and paging functionality. 這是系結至資料的慣用方法。This is the preferred method to bind to data.

  • 若要系結至執行System.Collections.IEnumerable介面的資料來源, 請以程式設計方式將ListView控制項的DataSource屬性設為數據源, 然後呼叫DataBind方法。To bind to a data source that implements the System.Collections.IEnumerable interface, programmatically set the DataSource property of the ListView control to the data source, and then call the DataBind method. 當您使用這項技術時ListView , 控制項不會提供內建的排序、更新、刪除和分頁功能。When you use this technique, the ListView control does not provide built-in sorting, updating, deleting, and paging functionality. 您必須使用適當的事件來提供這項功能。You must provide this functionality by using the appropriate event.

如需資料系結的詳細資訊, 請參閱ASP.NET 資料存取內容對應For more information about data binding, see ASP.NET Data Access Content Map.

注意

ListView控制項可以用來顯示使用者輸入, 其中可能包含惡意的用戶端腳本。The ListView control can be used to display user input, which might include malicious client script. 在應用程式中顯示之前, 檢查是否有任何從用戶端針對可執行檔腳本、SQL 語句或其他程式碼傳送的資訊。Check any information that is sent from a client for executable script, SQL statements, or other code before you display it in the application. 我們強烈建議您盡可能在此控制項中顯示值時, 以 HTML 編碼。We strongly recommend that values be HTML-encoded whenever possible before they are displayed in this control. ASP.NET 提供輸入要求驗證功能, 以協助封鎖使用者輸入中的腳本和 HTML。ASP.NET provides an input request validation feature to help block script and HTML in user input. 您也可以使用驗證服務器控制項來檢查使用者輸入。You can also use validation server controls to check user input. 如需詳細資訊, 請參閱驗證控制項簡介For more information, see Introduction to the Validation Controls.

資料作業Data Operations

當控制項系結至資料來源控制項時ListView , 控制項可以利用資料來源控制項的功能, 並提供自動排序、插入、更新和刪除功能。 ListViewWhen the ListView control is bound to a data source control, the ListView control can take advantage of the data source control's capabilities and provide automatic sort, insert, update, and delete functionality.

注意

ListView控制項可以提供對其他資料來源類型進行排序、插入、更新和刪除的支援。The ListView control can provide support for sorting, inserting, updating, and deleting with other types of data sources. 不過, 若要執行這些作業, 您必須在適當的事件處理常式中建立程式碼。However, in order to implement these operations, you must create code in an appropriate event handler.

因為此ListView控制項使用範本, 所以無法自動產生按鈕來執行更新、刪除、插入、排序或選取作業。Because the ListView control uses templates, it does not provide a way to automatically generate buttons to perform update, delete, insert, sort, or select operations. 您必須以手動方式將這些按鈕包含在適當的範本中。You must manually include these buttons in the appropriate template. 控制項可辨識其CommandName屬性設定為特定值的特定按鈕。 ListViewThe ListView control recognizes certain buttons whose CommandName property is set to a specific value. 下表列出ListView控制項可識別的按鈕及其功能。The following table lists the buttons that the ListView control recognizes and their functions.

按鈕Button CommandName 值CommandName value 說明Description
取消Cancel 退出"Cancel" 取消編輯或插入作業。Cancels an edit or insert operation. 引發 ItemCanceling 事件。Raises the ItemCanceling event.
刪除Delete "Delete""Delete" 將目前的資料錄從資料來源中刪除。Deletes the current record from the data source. ItemDeleted引發和ItemDeleting事件。Raises the ItemDeleted and ItemDeleting events.
SelectSelect "Select" 將屬性設定為專案DisplayIndex的屬性值。 SelectedIndexSets the SelectedIndex property to the DisplayIndex property value for the item. 呈現專案SelectedItemTemplate的範本。Renders the SelectedItemTemplate template for the item. SelectedIndexChanging引發和SelectedIndexChanged事件。Raises the SelectedIndexChanging and SelectedIndexChanged events.
EditEdit 編輯"Edit" 將專案置於編輯模式。Puts the item in edit mode. 呈現專案EditItemTemplate的範本。Renders the EditItemTemplate template for the item. 引發 ItemEditing 事件。Raises the ItemEditing event.
InsertInsert 插入"Insert" 將來自InsertItemTemplate範本的系結值插入至資料來源。Inserts the bound values from the InsertItemTemplate template into the data source. ItemInserting引發和ItemInserted事件。Raises the ItemInserting and ItemInserted events.
更新Update 更新"Update" 使用EditItemTemplate範本中的系結值, 更新資料來源中的目前記錄。Updates the current record in the data source with the bound values from the EditItemTemplate template. ItemUpdating引發和ItemUpdated事件。Raises the ItemUpdating and ItemUpdated events.
排序Sort 方式"Sort" 排序在按鈕的CommandArgument屬性中列出的資料行。Sorts the columns listed in the CommandArgument property of the button. Sorting引發和Sorted事件。Raises the Sorting and Sorted events.

不同于 [刪除] 按鈕 (這會立即刪除目前的資料項目), 按一下ListView [編輯] 按鈕時, 控制項會以編輯模式顯示目前的專案。Unlike the Delete button (which deletes the current data item immediately), when the Edit button is clicked, the ListView control displays the current item in edit mode. 在編輯模式中, 會顯示目前資料項目的EditItemTemplate屬性中所包含的內容。In edit mode, the content that is contained in the EditItemTemplate property is displayed for the current data item. 一般而言, 在 [編輯專案] 範本中, [編輯] 按鈕會取代為 [更新] 和 [取消] 按鈕。Typically, in the edit item template, the Edit button is replaced with an Update and a Cancel button. 適用于欄位資料類型 (例如TextBoxCheckBox控制項) 的輸入控制項, 通常也會顯示欄位的值供使用者修改。Input controls that are appropriate for the field's data type (such as a TextBox or CheckBox control) also usually display a field's value for a user to modify. 按一下 [更新] 按鈕會更新資料來源中的記錄, 然後按一下 [取消] 按鈕會取消編輯作業。Clicking the Update button updates the record in the data source, and clicking the Cancel button cancels the edit operation.

InsertItemPosition屬性設定為FirstItemLastItem時, 就會啟用插入功能。The insert functionality is enabled when the InsertItemPosition property is set to FirstItem or LastItem. 這個屬性會定義為InsertItemTemplate插入專案呈現範本的位置。This property defines where the InsertItemTemplate template is rendered for the insert item. 插入專案範本通常包含 [插入] 和 [取消] 按鈕, 而且會顯示空白的輸入控制項, 讓使用者輸入新記錄的值。The insert item template typically includes an Insert and a Cancel button, and empty input controls are displayed for users to enter the values for the new record. 按一下 [插入] 按鈕會在資料來源中插入記錄, 然後按一下 [取消] 按鈕會清除所有欄位。Clicking the Insert button inserts the record in the data source, and clicking the Cancel button clears all the fields.

排序Sorting

ListView控制項可讓使用者按一下 [排序] 按鈕來排序專案。The ListView control enables users to sort the items by clicking the Sort button. 排序功能是在包含要CommandArgument排序之資料行的按鈕屬性中定義。Sort functionality is defined in the CommandArgument property of the button that contains the columns to be sorted.

分頁Paging

ListView控制項可以將記錄分成數頁, 而不是同時顯示資料來源中的所有記錄。Instead of displaying all the records from the data source at the same time, the ListView control can break the records into pages. 若要啟用分頁, 請DataPager將控制項ListView與控制項建立關聯。To enable paging, associate a DataPager control with the ListView control. 然後將DataPager控制項插入LayoutTemplate範本內。Then insert a DataPager control inside the LayoutTemplate template. 或者, DataPager如果控制項位於PagedControlID ListView控制項外部, 請ID將屬性設定為ListView控制項的。Alternatively, if the DataPager control is outside the ListView control, set the PagedControlID property to the ID of the ListView control.

事件Events

下表列出ListView控制項支援的事件。The following table lists the events that are supported by the ListView control.

Event - 事件Event 說明Description
ItemCanceling 發生于按一下 [取消] 按鈕 (其CommandName屬性設為 "Cancel" 的按鈕) 時, 但在ListView控制項取消插入或編輯作業之前。Occurs when the Cancel button (a button with its CommandName property set to "Cancel") is clicked, but before the ListView control cancels the insert or edit operation. 這個事件通常用來停止取消作業。This event is often used to stop the cancel operation.
ItemCommand 按一下 ListView 控制項中的按鈕時會發生這個事件。Occurs when a button is clicked in the ListView control. 當您按一下控制項中的按鈕時, 通常會使用這個事件來執行自訂工作。This event is often used to perform a custom task when a button is clicked in the control.
ItemCreated 發生于ListView控制項中建立新專案時。Occurs when a new item is created in the ListView control. 建立專案時, 通常會使用此事件來修改專案的內容。This event is often used to modify the content of an item when the item is created.
ItemDataBound 當資料項目系結至ListView控制項中的資料時發生。Occurs when a data item is bound to data in the ListView control. 當專案系結至資料時, 通常會使用此事件來修改專案的內容。This event is often used to modify the content of an item when the item is bound to data.
ItemDeleted 發生于按一下 [ CommandName ListView刪除] 按鈕 (其屬性設為 [刪除] 的按鈕), DeleteItem或在控制項從資料來源刪除記錄之後, 呼叫方法時。Occurs when a Delete button (a button with its CommandName property set to "Delete") is clicked or the DeleteItem method is called, after the ListView control deletes the record from the data source. 這個事件通常用來檢查刪除作業的結果。This event is often used to check the results of the delete operation.
ItemDeleting 發生于按一下 [刪除] 按鈕 (其CommandName屬性設為 "Delete" 的按鈕) 時, DeleteItemListView呼叫方法, 但在控制項從資料來源刪除記錄之前。Occurs when a Delete button (a button with its CommandName property set to "Delete") is clicked or the DeleteItem method is called, but before the ListView control deletes the record from the data source. 這個事件通常是用來確認或取消刪除作業。This event is often used to confirm or cancel the delete operation.
ItemEditing 發生于按一下 [ CommandName ListView編輯] 按鈕 (其屬性設為 [編輯] 的按鈕) 時, 但在控制項進入編輯模式之前。Occurs when an Edit button (a button with its CommandName property set to "Edit") is clicked, but before the ListView control enters edit mode. 這個事件通常用來取消編輯作業。This event is often used to cancel the editing operation.
ItemInserted ListView控制項從資料來源插入新記錄之後, CommandName按一下插入按鈕 (其屬性設為 "Insert" InsertNewItem的按鈕) 或方法被呼叫時發生。Occurs when an Insert button (a button with its CommandName property set to "Insert") is clicked or the InsertNewItem method is called, after the ListView control inserts the new record from the data source. 這個事件通常用來檢查插入作業的結果。This event is often used to check the results of the insert operation.
ItemInserting 發生于按一下 [插入] 按鈕 (其CommandName屬性設為 "Insert" 的按鈕) 時, InsertNewItemListView呼叫方法, 但在控制項插入記錄之前。Occurs when an Insert button (a button with its CommandName property set to "Insert") is clicked or the InsertNewItem method is called, but before the ListView control inserts the record. 這個事件通常用來取消插入作業, 或變更或驗證新專案的值。This event is often used to cancel the insert operation or change or validate the values of the new item.
ItemUpdated 發生于按CommandName UpdateItem 下[更新]按鈕(其屬性設為"update"的按鈕),或在控制項更新記錄之後ListView呼叫方法時。Occurs when an Update button (a button with its CommandName property set to "Update") is clicked or the UpdateItem method is called, after the ListView control updates the record. 此事件通常用來檢查更新作業的結果。This event is often used to check the results of the update operation.
ItemUpdating 發生于CommandName UpdateItem按一下 [更新] 按鈕 (其屬性設為 "update" 的按鈕) 時, 或ListView呼叫方法, 但在控制項更新記錄之前。Occurs when an Update button (a button with its CommandName property set to "Update") is clicked or the UpdateItem method is called, but before the ListView control updates the record. 這個事件通常用來取消更新作業, 或變更或驗證已編輯專案的值。This event is often used to cancel the updating operation or change or validate the values of the edited item.
LayoutCreated LayoutTemplate 控制項中建立 ListView 樣板時發生。Occurs when the LayoutTemplate template is created in a ListView control. 此事件通常用來在建立範本之後執行工作。This event is often used to perform a task after the template is created.
PagePropertiesChanged 當頁面屬性變更時,在 ListView 控制項設定新的值之後發生。Occurs when the page properties change, after the ListView control sets the new values.
PagePropertiesChanging 發生于資料頁屬性變更時, 但在ListView控制項設定新值之前。Occurs when the data-page properties change, but before the ListView control sets the new values.
SelectedIndexChanged 發生于控制項處理選取作業之後, 按一下 [ CommandName ListView選取] 按鈕 (其屬性設為 "Select" 的按鈕) 時。Occurs when a Select button (a button with its CommandName property set to "Select") is clicked, after the ListView control handles the select operation. 在控制項中選取專案之後, 通常會使用這個事件來執行自訂工作。This event is often used to perform a custom task after an item is selected in the control.
SelectedIndexChanging 發生于按一下 [ CommandName ListView選取] 按鈕 (其屬性設為 "Select" 的按鈕) 時, 但在控制項處理選取作業之前。Occurs when a Select button (a button with its CommandName property set to "Select") is clicked, but before the ListView control handles the select operation. 此事件通常用來取消選取作業。This event is often used to cancel the select operation.
Sorted ListView控制項處理排序作業之後, 按一下排序按鈕CommandName (其屬性設為「排序」的按鈕) Sort , 或呼叫方法時, 就會發生。Occurs when a Sort button (a button with its CommandName property set to "Sort") is clicked or the Sort method is called, after the ListView control handles the sort operation. 這個事件通常是用來在使用者按一下排序按鈕, 且資料已排序之後, 執行自訂工作。This event is typically used to perform a custom task after a user clicks a Sort button and the data has been sorted.
Sorting 發生于按一下排序按鈕 (其CommandName屬性設為「排序」的按鈕) 時, SortListView呼叫方法, 但在控制項處理排序作業之前。Occurs when a Sort button (a button with its CommandName property set to "Sort") is clicked or the Sort method is called, but before the ListView control handles the sort operation. 這個事件通常用來取消排序作業或執行自訂排序常式。This event is often used to cancel the sorting operation or to perform a custom sorting routine.

宣告式語法Declarative Syntax

<asp:ListView  
    ConvertEmptyStringToNull="True|False"  
    DataKeyNames="string"  
    DataMember="string"  
    DataSource="string"  
    DataSourceID="string"  
    EditIndex="integer"  
    Enabled="True|False"  
    EnableTheming="True|False"  
    EnableViewState="True|False"  
    GroupPlaceholderID="string"  
    GroupItemCount="integer"  
    ID="string"  
    InsertItemPosition="None|FirstItem|LastItem"  
    ItemPlaceholderID="string"  
    OnDataBinding="DataBinding event handler"  
    OnDataBound="DataBound event handler"  
    OnDisposed="Disposed event handler"  
    OnInit="Init event handler"  
    OnItemCanceling="ItemCanceling event handler"  
    OnItemCommand="ItemCommand event handler"  
    OnItemCreated="ItemCreated event handler"  
    OnItemDataBound="ItemDataBound event handler"  
    OnItemDeleted="ItemDeleted event handler"  
    OnItemDeleting="ItemDeleting event handler"  
    OnItemEditing="ItemEditing event handler"  
    OnItemInserted="ItemInserted event handler"  
    OnItemInserting="ItemInserting event handler"  
    OnItemUpdated="ItemUpdated event handler"  
    OnItemUpdating="ItemUpdating event handler"  
    OnLayoutCreated="LayoutCreated event handler"  
    OnLoad="Load event handler"  
    OnPagePropertiesChanged="PagePropertiesChanged event handler"  
    OnPagePropertiesChanging="PagePropertiesChanging event handler"  
    OnPreRender="PreRender event handler"  
    OnSelectedIndexChanged="SelectedIndexChanged event handler"  
    OnSelectedIndexChanging="SelectedIndexChanging event handler"  
    OnSorted="Sorted event handler"  
    OnSorting="Sorting event handler"  
    OnUnload="Unload event handler"  
    runat="server"  
    SelectedIndex="integer"  
    SkinID="string"  
    Style="string"  
    Visible="True|False"  
>  
        <AlternatingItemTemplate>  
            <!-- child controls -->  
        </AlternatingItemTemplate>  
        <EditItemTemplate>  
            <!-- child controls -->  
        </EditItemTemplate>  
        <EmptyDataTemplate>  
            <!-- child controls -->  
        </EmptyDataTemplate>  
        <EmptyItemTemplate>  
            <!-- child controls -->  
        </EmptyItemTemplate>  
        <GroupSeparatorTemplate>  
            <!-- child controls -->  
        </GroupSeparatorTemplate>  
        <GroupTemplate>  
            <!-- child controls -->  
        </GroupTemplate>  
        <InsertItemTemplate>  
            <!-- child controls -->  
        </InsertItemTemplate>  
        <ItemSeparatorTemplate>  
            <!-- child controls -->  
        </ItemSeparatorTemplate>  
        <ItemTemplate>  
            <!-- child controls -->  
        </ItemTemplate>  
        <LayoutTemplate>  
                <!-- child controls -->  
        </LayoutTemplate>  
        <SelectedItemTemplate>  
            <!-- child controls -->  
        </SelectedItemTemplate>  
</asp:ListView>  

建構函式

ListView() ListView() ListView() ListView()

初始化 ListView 類別的新執行個體。Initializes a new instance of the ListView class.

屬性

AccessKey AccessKey AccessKey AccessKey

覆寫 AccessKey 屬性。Overrides the AccessKey property. ListView 控制項不支援設定這個屬性。Setting this property is not supported by the ListView control.

Adapter Adapter Adapter Adapter

針對控制項取得瀏覽器的特定配置器。Gets the browser-specific adapter for the control.

(Inherited from Control)
AlternatingItemTemplate AlternatingItemTemplate AlternatingItemTemplate AlternatingItemTemplate

取得或設定 ListView 控制項中替代資料項目的自訂內容。Gets or sets the custom content for the alternating data item in a ListView control.

AppRelativeTemplateSourceDirectory AppRelativeTemplateSourceDirectory AppRelativeTemplateSourceDirectory AppRelativeTemplateSourceDirectory

取得或設定包含了此控制項之 PageUserControl 物件的相對應用程式虛擬目錄。Gets or sets the application-relative virtual directory of the Page or UserControl object that contains this control.

(Inherited from Control)
Attributes Attributes Attributes Attributes

取得任意屬性 (Attribute) 的集合 (只供呈現),不與控制項上的屬性 (Property) 對應。Gets the collection of arbitrary attributes (for rendering only) that do not correspond to properties on the control.

(Inherited from WebControl)
BackColor BackColor BackColor BackColor

覆寫 BackColor 屬性。Overrides the BackColor property. ListView 控制項不支援設定這個屬性。Setting this property is not supported by the ListView control.

BindingContainer BindingContainer BindingContainer BindingContainer

取得包含了此控制項之資料繫結的控制項。Gets the control that contains this control's data binding.

(Inherited from Control)
BorderColor BorderColor BorderColor BorderColor

覆寫 BorderColor 屬性。Overrides the BorderColor property. ListView 控制項不支援設定這個屬性。Setting this property is not supported by the ListView control.

BorderStyle BorderStyle BorderStyle BorderStyle

覆寫 BorderStyle 屬性。Overrides the BorderStyle property. ListView 控制項不支援設定這個屬性。Setting this property is not supported by the ListView control.

BorderWidth BorderWidth BorderWidth BorderWidth

覆寫 BorderWidth 屬性。Overrides the BorderWidth property. ListView 控制項不支援設定這個屬性。Setting this property is not supported by the ListView control.

ChildControlsCreated ChildControlsCreated ChildControlsCreated ChildControlsCreated

取得值,指出是否已經建立伺服器控制項的子控制項。Gets a value that indicates whether the server control's child controls have been created.

(Inherited from Control)
ClientID ClientID ClientID ClientID

取得 ASP.NET 所產生之 HTML 標記的控制項識別碼。Gets the control ID for HTML markup that is generated by ASP.NET.

(Inherited from Control)
ClientIDMode ClientIDMode ClientIDMode ClientIDMode

取得或設定用來產生 ClientID 屬性值的演算法。Gets or sets the algorithm that is used to generate the value of the ClientID property.

(Inherited from Control)
ClientIDRowSuffix ClientIDRowSuffix ClientIDRowSuffix ClientIDRowSuffix

取得或設定資料欄位的名稱,這個資料欄位的值會在 ListView 屬性設為 ClientIDMode 時,用來識別 Predictable 控制項的每個唯一的資料列。Gets or sets the name of the data field whose value is used to uniquely identify each data row of a ListView control when the ClientIDMode property is set to Predictable.

ClientIDRowSuffixDataKeys ClientIDRowSuffixDataKeys ClientIDRowSuffixDataKeys ClientIDRowSuffixDataKeys

取得資料值,這些值會在 ASP.NET 產生 ClientID 值時,用來識別資料繫結控制項的每個唯一的執行個體。Gets the data values that are used to uniquely identify each instance of a data-bound control when ASP.NET generates the ClientID value.

ClientIDSeparator ClientIDSeparator ClientIDSeparator ClientIDSeparator

取得字元值,表示在 ClientID 屬性中所使用的分隔字元。Gets a character value representing the separator character used in the ClientID property.

(Inherited from Control)
Context Context Context Context

取得與目前 Web 要求的伺服器控制項關聯的 HttpContext 物件。Gets the HttpContext object associated with the server control for the current Web request.

(Inherited from Control)
Controls Controls Controls Controls

取得 ControlCollection 物件,這個物件表示 ListView 控制項的子控制項。Gets a ControlCollection object that represents the child controls of the ListView control.

ControlStyle ControlStyle ControlStyle ControlStyle

取得 Web 伺服器控制項的樣式。Gets the style of the Web server control. 這個屬性主要由控制項開發人員使用。This property is used primarily by control developers.

(Inherited from WebControl)
ControlStyleCreated ControlStyleCreated ControlStyleCreated ControlStyleCreated

取得值,指出 Style 物件是否已經為 ControlStyle 屬性建立。Gets a value indicating whether a Style object has been created for the ControlStyle property. 這個屬性主要由控制項開發人員使用。This property is primarily used by control developers.

(Inherited from WebControl)
ConvertEmptyStringToNull ConvertEmptyStringToNull ConvertEmptyStringToNull ConvertEmptyStringToNull

取得或設定值,表示在資料來源中更新資料欄位時,是否將空字串值 ("") 自動轉換為 null 值。Gets or sets a value that indicates whether empty string values ("") are automatically converted to null values when the data field is updated in the data source.

CssClass CssClass CssClass CssClass

覆寫 CssClass 屬性。Overrides the CssClass property. ListView 控制項不支援設定這個屬性。Setting this property is not supported by the ListView control.

DataItemContainer DataItemContainer DataItemContainer DataItemContainer

如果命名容器實作 IDataItemContainer,則取得命名容器的參考。Gets a reference to the naming container if the naming container implements IDataItemContainer.

(Inherited from Control)
DataKeyNames DataKeyNames DataKeyNames DataKeyNames

取得或設定陣列,這個陣列包含 ListView 控制項中所顯示項目的主索引鍵欄位名稱。Gets or sets an array that contains the names of the primary key fields for the items displayed in a ListView control.

DataKeys DataKeys DataKeys DataKeys

取得 DataKey 物件的集合,這些物件表示 ListView 控制項中每一個項目的資料索引鍵值。Gets a collection of DataKey objects that represent the data-key value for each item in a ListView control.

DataKeysContainer DataKeysContainer DataKeysContainer DataKeysContainer

如果命名容器實作 IDataKeysControl,則取得命名容器的參考。Gets a reference to the naming container if the naming container implements IDataKeysControl.

(Inherited from Control)
DataMember DataMember DataMember DataMember

取得或設定資料繫結控制項繫結至的資料清單名稱 (如果資料來源包含多個不同資料項目清單)。Gets or sets the name of the list of data that the data-bound control binds to, in cases where the data source contains more than one distinct list of data items.

(Inherited from DataBoundControl)
DataSource DataSource DataSource DataSource

取得或設定資料繫結控制項從中擷取其資料項目清單的物件。Gets or sets the object from which the data-bound control retrieves its list of data items.

(Inherited from BaseDataBoundControl)
DataSourceID DataSourceID DataSourceID DataSourceID

取得或設定控制項 ID,資料繫結控制項從該 ID 擷取其資料項目清單。Gets or sets the ID of the control from which the data-bound control retrieves its list of data items.

(Inherited from DataBoundControl)
DataSourceObject DataSourceObject DataSourceObject DataSourceObject

取得物件,這個物件會實作可提供物件資料內容之存取權的 IDataSource 介面。Gets an object that implements the IDataSource interface, which provides access to the object's data content.

(Inherited from DataBoundControl)
DeleteMethod DeleteMethod DeleteMethod DeleteMethod

為了刪除資料,取得或設定要呼叫的方法名稱。Gets or sets the name of the method to call in order to delete data.

DesignMode DesignMode DesignMode DesignMode

取得值,指出控制項是否正用於設計介面上。Gets a value indicating whether a control is being used on a design surface.

(Inherited from Control)
EditIndex EditIndex EditIndex EditIndex

取得或設定正在編輯之項目的索引。Gets or sets the index of the item being edited.

EditItem EditItem EditItem EditItem

取得 ListView 控制項中處於編輯模式的項目。Gets the item that is in edit mode in a ListView control.

EditItemTemplate EditItemTemplate EditItemTemplate EditItemTemplate

取得或設定編輯模式中項目的自訂內容。Gets or sets the custom content for the item in edit mode.

EmptyDataTemplate EmptyDataTemplate EmptyDataTemplate EmptyDataTemplate

取得或設定空白樣板的使用者定義內容,當 ListView 控制項繫結至不包含任何資料錄的資料來源時會呈現該空白樣板。Gets or sets the user-defined content for the empty template that is rendered when a ListView control is bound to a data source that does not contain any records.

EmptyItemTemplate EmptyItemTemplate EmptyItemTemplate EmptyItemTemplate

取得或設定空白項目的使用者定義內容,當目前資料頁的最後一筆資料列已沒有可顯示的資料項目時,ListView 控制項中會呈現該空白項目。Gets or sets the user-defined content for the empty item that is rendered in a ListView control when there are no more data items to display in the last row of the current data page.

Enabled Enabled Enabled Enabled

取得或設定值,指出 Web 伺服器控制項是否啟用。Gets or sets a value indicating whether the Web server control is enabled.

(Inherited from WebControl)
EnableModelValidation EnableModelValidation EnableModelValidation EnableModelValidation

取得或設定值,這個值表示驗證程式控制項是否要處理在插入或更新作業期間發生的例外狀況。Gets or sets a value that indicates whether a validator control will handle exceptions that occur during insert or update operations.

EnablePersistedSelection EnablePersistedSelection EnablePersistedSelection EnablePersistedSelection

取得或設定值,這個值表示當使用者逐頁巡覽資料繫結控制項中的資料時,是否保存資料列選取範圍。Gets or sets a value that indicates whether row selection persists when a user pages through data in a data-bound control.

EnableTheming EnableTheming EnableTheming EnableTheming

取得或設定值,指出佈景主題是否套用至此控制項。Gets or sets a value indicating whether themes apply to this control.

(Inherited from WebControl)
EnableViewState EnableViewState EnableViewState EnableViewState

取得或設定值,該值表示伺服器控制項是否對要求的用戶端而言保持其檢視狀態,以及它包含的任何子控制項狀態。Gets or sets a value indicating whether the server control persists its view state, and the view state of any child controls it contains, to the requesting client.

(Inherited from Control)
Events Events Events Events

取得控制項事件處理常式委派 (Delegate) 的清單。Gets a list of event handler delegates for the control. 這個屬性是唯讀的。This property is read-only.

(Inherited from Control)
Font Font Font Font

覆寫 Font 屬性。Overrides the Font property. ListView 控制項不支援這個屬性。This property is not supported by the ListView control.

ForeColor ForeColor ForeColor ForeColor

覆寫 ForeColor 屬性。Overrides the ForeColor property. ListView 控制項不支援設定這個屬性。Setting this property is not supported by the ListView control.

GroupItemCount GroupItemCount GroupItemCount GroupItemCount

取得或設定 ListView 控制項中每一個群組所顯示的項目數目。Gets or sets the number of items to display per group in a ListView control.

GroupPlaceholderID GroupPlaceholderID GroupPlaceholderID GroupPlaceholderID

取得或設定 ListView 控制項中群組預留位置的 ID。Gets or sets the ID for the group placeholder in a ListView control.

GroupSeparatorTemplate GroupSeparatorTemplate GroupSeparatorTemplate GroupSeparatorTemplate

取得或設定 ListView 控制項中群組之間分隔符號的使用者定義內容。Gets or sets the user-defined content for the separator between groups in a ListView control.

GroupTemplate GroupTemplate GroupTemplate GroupTemplate

取得或設定 ListView 控制項中群組容器的使用者定義內容。Gets or sets the user-defined content for the group container in a ListView control.

HasAttributes HasAttributes HasAttributes HasAttributes

取得值,指出控制項是否已經設定屬性。Gets a value indicating whether the control has attributes set.

(Inherited from WebControl)
HasChildViewState HasChildViewState HasChildViewState HasChildViewState

取得值,指出目前伺服器控制項的子控制項是否有任何已儲存的檢視狀態設定。Gets a value indicating whether the current server control's child controls have any saved view-state settings.

(Inherited from Control)
Height Height Height Height

覆寫 Height 屬性。Overrides the Height property. ListView 控制項不支援設定這個屬性。Setting this property is not supported by the ListView control.

IControlBuilderAccessor.ControlBuilder IControlBuilderAccessor.ControlBuilder IControlBuilderAccessor.ControlBuilder IControlBuilderAccessor.ControlBuilder

如需這個成員的說明,請參閱 ControlBuilderFor a description of this member, see ControlBuilder.

(Inherited from Control)
IControlDesignerAccessor.UserData IControlDesignerAccessor.UserData IControlDesignerAccessor.UserData IControlDesignerAccessor.UserData

如需這個成員的說明,請參閱 UserDataFor a description of this member, see UserData.

(Inherited from Control)
ID ID ID ID

取得或設定指派給伺服器控制項的程式設計識別項。Gets or sets the programmatic identifier assigned to the server control.

(Inherited from Control)
IDataBindingsAccessor.DataBindings IDataBindingsAccessor.DataBindings IDataBindingsAccessor.DataBindings IDataBindingsAccessor.DataBindings

如需這個成員的說明,請參閱 DataBindingsFor a description of this member, see DataBindings.

(Inherited from Control)
IDataBindingsAccessor.HasDataBindings IDataBindingsAccessor.HasDataBindings IDataBindingsAccessor.HasDataBindings IDataBindingsAccessor.HasDataBindings

如需這個成員的說明,請參閱 HasDataBindingsFor a description of this member, see HasDataBindings.

(Inherited from Control)
IdSeparator IdSeparator IdSeparator IdSeparator

取得用來分隔控制項識別項的字元。Gets the character used to separate control identifiers.

(Inherited from Control)
IExpressionsAccessor.Expressions IExpressionsAccessor.Expressions IExpressionsAccessor.Expressions IExpressionsAccessor.Expressions

如需這個成員的說明,請參閱 ExpressionsFor a description of this member, see Expressions.

(Inherited from Control)
IExpressionsAccessor.HasExpressions IExpressionsAccessor.HasExpressions IExpressionsAccessor.HasExpressions IExpressionsAccessor.HasExpressions

如需這個成員的說明,請參閱 HasExpressionsFor a description of this member, see HasExpressions.

(Inherited from Control)
Initialized Initialized Initialized Initialized

取得值,指出是否已初始化資料繫結控制項。Gets a value indicating whether the data-bound control has been initialized.

(Inherited from BaseDataBoundControl)
InsertItem InsertItem InsertItem InsertItem

取得 ListView 控制項的插入項目。Gets the insert item of a ListView control.

InsertItemPosition InsertItemPosition InsertItemPosition InsertItemPosition

取得或設定 InsertItemTemplate 樣板在 ListView 控制項中呈現的位置。Gets or sets the location of the InsertItemTemplate template when it is rendered as part of the ListView control.

InsertItemTemplate InsertItemTemplate InsertItemTemplate InsertItemTemplate

取得或設定 ListView 控制項中的插入項目的自訂內容。Gets or sets the custom content for an insert item in the ListView control.

InsertMethod InsertMethod InsertMethod InsertMethod

為了插入資料,取得或設定要呼叫的方法名稱。Gets or sets the name of the method to call in order to insert data.

IsBoundUsingDataSourceID IsBoundUsingDataSourceID IsBoundUsingDataSourceID IsBoundUsingDataSourceID

取得值,指出是否已設定 DataSourceID 屬性。Gets a value indicating whether the DataSourceID property is set.

(Inherited from BaseDataBoundControl)
IsChildControlStateCleared IsChildControlStateCleared IsChildControlStateCleared IsChildControlStateCleared

取得值,指出這個控制項中所包含的控制項是否有控制項狀態。Gets a value indicating whether controls contained within this control have control state.

(Inherited from Control)
IsDataBindingAutomatic IsDataBindingAutomatic IsDataBindingAutomatic IsDataBindingAutomatic

取得值,指出資料繫結是否為自動。Gets a value that indicates whether data binding is automatic.

(Inherited from BaseDataBoundControl)
IsEnabled IsEnabled IsEnabled IsEnabled

取得值,指出是否啟用控制項。Gets a value indicating whether the control is enabled.

(Inherited from WebControl)
IsTrackingViewState IsTrackingViewState IsTrackingViewState IsTrackingViewState

取得值,指出伺服器控制項是否正在儲存檢視狀態的變更。Gets a value that indicates whether the server control is saving changes to its view state.

(Inherited from Control)
IsUsingModelBinders IsUsingModelBinders IsUsingModelBinders IsUsingModelBinders

取得值,指出模型繫結是否正在使用。Gets a value that indicates whether model binding is in use.

IsViewStateEnabled IsViewStateEnabled IsViewStateEnabled IsViewStateEnabled

取得值,指出這個控制項是否已啟用檢視狀態。Gets a value indicating whether view state is enabled for this control.

(Inherited from Control)
ItemPlaceholderID ItemPlaceholderID ItemPlaceholderID ItemPlaceholderID

取得或設定 ListView 控制項中項目預留位置的 ID。Gets or sets the ID for the item placeholder in a ListView control.

Items Items Items Items

取得 ListViewDataItem 物件的集合,這些物件表示 ListView 控制項中目前資料頁的資料項目。Gets a collection of ListViewDataItem objects that represent the data items of the current page of data in a ListView control.

ItemSeparatorTemplate ItemSeparatorTemplate ItemSeparatorTemplate ItemSeparatorTemplate

取得或設定 ListView 控制項中項目之間分隔符號的自訂內容。Gets or sets the custom content for the separator between the items in a ListView control.

ItemTemplate ItemTemplate ItemTemplate ItemTemplate

取得或設定 ListView 控制項中資料項目的自訂內容。Gets or sets the custom content for the data item in a ListView control.

ItemType ItemType ItemType ItemType

取得或設定強型別資料繫結的資料項目型別名稱。Gets or sets the name of the data item type for strongly typed data binding.

(Inherited from DataBoundControl)
LayoutTemplate LayoutTemplate LayoutTemplate LayoutTemplate

取得或設定 ListView 控制項中根容器的自訂內容。Gets or sets the custom content for the root container in a ListView control.

LoadViewStateByID LoadViewStateByID LoadViewStateByID LoadViewStateByID

取得值,指出控制項是否依 ID (而不是索引) 參與載入其檢視狀態。Gets a value indicating whether the control participates in loading its view state by ID instead of index.

(Inherited from Control)
MaximumRows MaximumRows MaximumRows MaximumRows

取得在 ListView 控制項的單一頁面上顯示的項目最大數目。Gets the maximum number of items to display on a single page of the ListView control.

NamingContainer NamingContainer NamingContainer NamingContainer

取得伺服器控制項命名容器的參考,其建立唯一命名空間,在具有相同 ID 屬性值的伺服器控制項之間作區別。Gets a reference to the server control's naming container, which creates a unique namespace for differentiating between server controls with the same ID property value.

(Inherited from Control)
Page Page Page Page

取得含有伺服器控制項的 Page 執行個體的參考。Gets a reference to the Page instance that contains the server control.

(Inherited from Control)
Parent Parent Parent Parent

在網頁控制階層架構中取得伺服器控制項之父控制項的參考。Gets a reference to the server control's parent control in the page control hierarchy.

(Inherited from Control)
RenderingCompatibility RenderingCompatibility RenderingCompatibility RenderingCompatibility

取得值,這個值會指定將與呈現 HTML 相容的 ASP.NET 版本。Gets a value that specifies the ASP.NET version that rendered HTML will be compatible with.

(Inherited from Control)
RequiresDataBinding RequiresDataBinding RequiresDataBinding RequiresDataBinding

取得或設定值,指出是否應該呼叫 DataBind() 方法。Gets or sets a value indicating whether the DataBind() method should be called.

(Inherited from BaseDataBoundControl)
SelectArguments SelectArguments SelectArguments SelectArguments

取得 DataSourceSelectArguments 物件,當從資料來源控制項擷取資料時資料繫結控制項會使用它。Gets a DataSourceSelectArguments object that the data-bound control uses when retrieving data from a data source control.

(Inherited from DataBoundControl)
SelectedDataKey SelectedDataKey SelectedDataKey SelectedDataKey

取得 ListView 控制項中所選取項目的資料索引鍵值。Gets the data-key value for the selected item in a ListView control.

SelectedIndex SelectedIndex SelectedIndex SelectedIndex

取得或設定 ListView 控制項中所選取項目的索引。Gets or sets the index of the selected item in a ListView control.

SelectedItemTemplate SelectedItemTemplate SelectedItemTemplate SelectedItemTemplate

取得或設定 ListView 控制項中選取之項目的自訂內容。Gets or sets the custom content for the selected item in a ListView control.

SelectedPersistedDataKey SelectedPersistedDataKey SelectedPersistedDataKey SelectedPersistedDataKey

為資料繫結控制項中持續選取的項目,取得或設定資料索引鍵值。Gets or sets the data-key value for the persisted selected item in a data-bound control.

SelectedValue SelectedValue SelectedValue SelectedValue

取得 ListView 控制項中選取之項目的資料索引鍵值。Gets the data-key value of the selected item in a ListView control.

SelectMethod SelectMethod SelectMethod SelectMethod

為了讀取資料要呼叫的方法的名稱。The name of the method to call in order to read data.

(Inherited from DataBoundControl)
Site Site Site Site

當呈現在設計介面上時,取得裝載目前控制項之容器的資訊。Gets information about the container that hosts the current control when rendered on a design surface.

(Inherited from Control)
SkinID SkinID SkinID SkinID

取得或設定要套用至控制項的面板。Gets or sets the skin to apply to the control.

(Inherited from WebControl)
SortDirection SortDirection SortDirection SortDirection

取得目前排序之欄位的排序方向。Gets the sort direction of the field or fields that are being sorted.

SortExpression SortExpression SortExpression SortExpression

取得與目前排序的欄位相關聯的排序運算式。Gets the sort expression that is associated with the field or fields that are being sorted.

StartRowIndex StartRowIndex StartRowIndex StartRowIndex

取得 ListView 控制項中的資料頁所顯示之第一筆資料錄的索引。Gets the index of the first record that is displayed on a page of data in the ListView control.

Style Style Style Style

取得文字屬性的集合,將呈現為 Web 伺服器控制項的外部標記上的樣式屬性。Gets a collection of text attributes that will be rendered as a style attribute on the outer tag of the Web server control.

(Inherited from WebControl)
SupportsDisabledAttribute SupportsDisabledAttribute SupportsDisabledAttribute SupportsDisabledAttribute

取得值,這個值表示當控制項的 IsEnabled 屬性為 disabled 時,控制項是否應該將所轉譯 HTML 項目的 false 屬性設為 "disabled"。Gets a value that indicates whether the control should set the disabled attribute of the rendered HTML element to "disabled" when the control's IsEnabled property is false.

(Inherited from BaseDataBoundControl)
TabIndex TabIndex TabIndex TabIndex

覆寫 TabIndex 屬性。Overrides the TabIndex property. ListView 控制項不支援設定這個屬性。Setting this property is not supported by the ListView control.

TagKey TagKey TagKey TagKey

取得對應至這個 Web 伺服器控制項的 HtmlTextWriterTag 值。Gets the HtmlTextWriterTag value that corresponds to this Web server control. 這個屬性主要由控制項開發人員使用。This property is used primarily by control developers.

(Inherited from WebControl)
TagName TagName TagName TagName

取得控制項標記的名稱。Gets the name of the control tag. 這個屬性主要由控制項開發人員使用。This property is used primarily by control developers.

(Inherited from WebControl)
TemplateControl TemplateControl TemplateControl TemplateControl

取得或設定包含了此控制項之樣板的參考。Gets or sets a reference to the template that contains this control.

(Inherited from Control)
TemplateSourceDirectory TemplateSourceDirectory TemplateSourceDirectory TemplateSourceDirectory

取得包含目前伺服器控制項的 PageUserControl 的虛擬目錄。Gets the virtual directory of the Page or UserControl that contains the current server control.

(Inherited from Control)
ToolTip ToolTip ToolTip ToolTip

覆寫 ToolTip 屬性。Overrides the ToolTip property. ListView 控制項不支援設定這個屬性。Setting this property is not supported by the ListView control.

UniqueID UniqueID UniqueID UniqueID

取得伺服器控制項唯一的、符合階層架構的識別項。Gets the unique, hierarchically qualified identifier for the server control.

(Inherited from Control)
UpdateMethod UpdateMethod UpdateMethod UpdateMethod

為了更新資料,取得或設定要呼叫的方法名稱。Gets or sets the name of the method to call in order to update data.

ValidateRequestMode ValidateRequestMode ValidateRequestMode ValidateRequestMode

取得或設定值,指出控制項是否對來自瀏覽器的用戶端輸入檢查潛在的危險值。Gets or sets a value that indicates whether the control checks client input from the browser for potentially dangerous values.

(Inherited from Control)
ViewState ViewState ViewState ViewState

取得狀態資訊的字典,允許您在相同網頁的多個要求之間,儲存和還原伺服器控制項的檢視狀態。Gets a dictionary of state information that allows you to save and restore the view state of a server control across multiple requests for the same page.

(Inherited from Control)
ViewStateIgnoresCase ViewStateIgnoresCase ViewStateIgnoresCase ViewStateIgnoresCase

取得值,指出 StateBag 物件是否不區分大小寫。Gets a value that indicates whether the StateBag object is case-insensitive.

(Inherited from Control)
ViewStateMode ViewStateMode ViewStateMode ViewStateMode

取得或設定這個控制項的檢視狀態模式。Gets or sets the view-state mode of this control.

(Inherited from Control)
Visible Visible Visible Visible

取得或設定值,指出伺服器控制項是否會轉譯為頁面上的 UI。Gets or sets a value that indicates whether a server control is rendered as UI on the page.

(Inherited from Control)
Width Width Width Width

覆寫 Width 屬性。Overrides the Width property. ListView 控制項不支援設定這個屬性。Setting this property is not supported by the ListView control.

方法

AddAttributesToRender(HtmlTextWriter) AddAttributesToRender(HtmlTextWriter) AddAttributesToRender(HtmlTextWriter) AddAttributesToRender(HtmlTextWriter)

將需要呈現的 HTML 屬性和樣式加入至指定的 HtmlTextWriterTag 中。Adds HTML attributes and styles that need to be rendered to the specified HtmlTextWriterTag. 這個方法主要由控制項開發人員使用。This method is used primarily by control developers.

(Inherited from WebControl)
AddControlToContainer(Control, Control, Int32) AddControlToContainer(Control, Control, Int32) AddControlToContainer(Control, Control, Int32) AddControlToContainer(Control, Control, Int32)

將指定的控制項加入至指定的容器。Adds the specified control to the specified container.

AddedControl(Control, Int32) AddedControl(Control, Int32) AddedControl(Control, Int32) AddedControl(Control, Int32)

在子控制項加入 Control 物件的 Controls 集合後呼叫。Called after a child control is added to the Controls collection of the Control object.

(Inherited from Control)
AddParsedSubObject(Object) AddParsedSubObject(Object) AddParsedSubObject(Object) AddParsedSubObject(Object)

通知伺服器控制項,XML 或 HTML 項目已剖析,並將項目加入伺服器控制項的 ControlCollection 物件中。Notifies the server control that an element, either XML or HTML, was parsed, and adds the element to the server control's ControlCollection object.

(Inherited from Control)
ApplyStyle(Style) ApplyStyle(Style) ApplyStyle(Style) ApplyStyle(Style)

將指定樣式的任何非空白項目加入到 Web 控制項中,覆寫控制項的任何現有的樣式項目。Copies any nonblank elements of the specified style to the Web control, overwriting any existing style elements of the control. 這個方法主要由控制項開發人員使用。This method is primarily used by control developers.

(Inherited from WebControl)
ApplyStyleSheetSkin(Page) ApplyStyleSheetSkin(Page) ApplyStyleSheetSkin(Page) ApplyStyleSheetSkin(Page)

將頁面樣式表中所定義的樣式屬性套用至控制項。Applies the style properties defined in the page style sheet to the control.

(Inherited from Control)
BeginRenderTracing(TextWriter, Object) BeginRenderTracing(TextWriter, Object) BeginRenderTracing(TextWriter, Object) BeginRenderTracing(TextWriter, Object)

開始進行轉譯資料的設計階段追蹤。Begins design-time tracing of rendering data.

(Inherited from Control)
BuildProfileTree(String, Boolean) BuildProfileTree(String, Boolean) BuildProfileTree(String, Boolean) BuildProfileTree(String, Boolean)

收集伺服器控制項的相關資訊,並在頁面啟用追蹤時將此資訊傳遞至 Trace 屬性以顯示之。Gathers information about the server control and delivers it to the Trace property to be displayed when tracing is enabled for the page.

(Inherited from Control)
ClearCachedClientID() ClearCachedClientID() ClearCachedClientID() ClearCachedClientID()

將快取的 ClientID 值設定為 nullSets the cached ClientID value to null.

(Inherited from Control)
ClearChildControlState() ClearChildControlState() ClearChildControlState() ClearChildControlState()

刪除伺服器控制項之子控制項的控制項狀態資訊。Deletes the control-state information for the server control's child controls.

(Inherited from Control)
ClearChildState() ClearChildState() ClearChildState() ClearChildState()

刪除所有伺服器控制項之子控制項的檢視狀態和控制項狀態資訊。Deletes the view-state and control-state information for all the server control's child controls.

(Inherited from Control)
ClearChildViewState() ClearChildViewState() ClearChildViewState() ClearChildViewState()

刪除所有伺服器控制項之子控制項的檢視狀態資訊。Deletes the view-state information for all the server control's child controls.

(Inherited from Control)
ClearEffectiveClientIDMode() ClearEffectiveClientIDMode() ClearEffectiveClientIDMode() ClearEffectiveClientIDMode()

將目前的控制項執行個體和任何子控制項的 ClientIDMode 屬性設定為 InheritSets the ClientIDMode property of the current control instance and of any child controls to Inherit.

(Inherited from Control)
ConfirmInitState() ConfirmInitState() ConfirmInitState() ConfirmInitState()

設定資料繫結控制項之初始化的狀態。Sets the initialized state of the data-bound control.

(Inherited from BaseDataBoundControl)
CopyBaseAttributes(WebControl) CopyBaseAttributes(WebControl) CopyBaseAttributes(WebControl) CopyBaseAttributes(WebControl)

將不被 Style 物件封裝的屬性從指定的 Web 伺服器控制項複製到呼叫這個方法的 Web 伺服器控制項上。Copies the properties not encapsulated by the Style object from the specified Web server control to the Web server control that this method is called from. 這個方法主要由控制項開發人員使用。This method is used primarily by control developers.

(Inherited from WebControl)
CreateChildControls() CreateChildControls() CreateChildControls() CreateChildControls()

根據檢視狀態中儲存的值,建立用於呈現 ListView 控制項的控制階層架構。Creates the control hierarchy that is used to render the ListView control, based on the values that are stored in view state.

CreateChildControls(IEnumerable, Boolean) CreateChildControls(IEnumerable, Boolean) CreateChildControls(IEnumerable, Boolean) CreateChildControls(IEnumerable, Boolean)

使用特定資料來源建立用於呈現 ListView 控制項的控制階層架構。Creates the control hierarchy that is used to render the ListView control by using the specified data source.

CreateControlCollection() CreateControlCollection() CreateControlCollection() CreateControlCollection()

建立新的 ControlCollection 物件來保存伺服器控制項的子控制項 (常值和伺服器)。Creates a new ControlCollection object to hold the child controls (both literal and server) of the server control.

(Inherited from Control)
CreateControlStyle() CreateControlStyle() CreateControlStyle() CreateControlStyle()

建立控制項的預設樣式。Creates the default style for the control.

CreateDataItem(Int32, Int32) CreateDataItem(Int32, Int32) CreateDataItem(Int32, Int32) CreateDataItem(Int32, Int32)

ListView 控制項中建立資料項目。Creates a data item in the ListView control.

CreateDataSourceSelectArguments() CreateDataSourceSelectArguments() CreateDataSourceSelectArguments() CreateDataSourceSelectArguments()

建立 DataSourceSelectArguments 物件,這個物件包含傳遞至資料來源的引數。Creates the DataSourceSelectArguments object that contains the arguments that are passed to the data source.

CreateEmptyDataItem() CreateEmptyDataItem() CreateEmptyDataItem() CreateEmptyDataItem()

EmptyDataTemplate 控制項中建立 ListView 樣板。Creates the EmptyDataTemplate template in the ListView control.

CreateEmptyItem() CreateEmptyItem() CreateEmptyItem() CreateEmptyItem()

ListView 控制項中建立空白項目。Creates an empty item in the ListView control.

CreateInsertItem() CreateInsertItem() CreateInsertItem() CreateInsertItem()

ListView 控制項中建立插入項目。Creates an insert item in the ListView control.

CreateItem(ListViewItemType) CreateItem(ListViewItemType) CreateItem(ListViewItemType) CreateItem(ListViewItemType)

建立指定之型別的 ListViewItem 物件。Creates a ListViewItem object with the specified type.

CreateItemsInGroups(ListViewPagedDataSource, Boolean, InsertItemPosition, ArrayList) CreateItemsInGroups(ListViewPagedDataSource, Boolean, InsertItemPosition, ArrayList) CreateItemsInGroups(ListViewPagedDataSource, Boolean, InsertItemPosition, ArrayList) CreateItemsInGroups(ListViewPagedDataSource, Boolean, InsertItemPosition, ArrayList)

分組建立 ListView 控制階層架構。Creates the ListView control hierarchy in groups.

CreateItemsWithoutGroups(ListViewPagedDataSource, Boolean, InsertItemPosition, ArrayList) CreateItemsWithoutGroups(ListViewPagedDataSource, Boolean, InsertItemPosition, ArrayList) CreateItemsWithoutGroups(ListViewPagedDataSource, Boolean, InsertItemPosition, ArrayList) CreateItemsWithoutGroups(ListViewPagedDataSource, Boolean, InsertItemPosition, ArrayList)

建立不分組的 ListView 控制階層架構。Creates the ListView control hierarchy without groups.

CreateLayoutTemplate() CreateLayoutTemplate() CreateLayoutTemplate() CreateLayoutTemplate()

ListView 控制項中建立根容器。Creates the root container in the ListView control.

CreateSuffixArrayList(ListViewPagedDataSource, ArrayList) CreateSuffixArrayList(ListViewPagedDataSource, ArrayList) CreateSuffixArrayList(ListViewPagedDataSource, ArrayList) CreateSuffixArrayList(ListViewPagedDataSource, ArrayList)

建立尾碼陣列,供 ASP.NET 在產生 ClientID 值時使用。Creates an array of suffixes for ASP.NET to use when it generates the ClientID value.

DataBind() DataBind() DataBind() DataBind()

將資料來源繫結至叫用的伺服器控制項和它的全部子控制項。Binds a data source to the invoked server control and all its child controls.

(Inherited from BaseDataBoundControl)
DataBind(Boolean) DataBind(Boolean) DataBind(Boolean) DataBind(Boolean)

使用會引發 DataBinding 事件的選項,繫結資料來源至叫用的伺服器控制項及其所有子控制項。Binds a data source to the invoked server control and all its child controls with an option to raise the DataBinding event.

(Inherited from Control)
DataBindChildren() DataBindChildren() DataBindChildren() DataBindChildren()

繫結資料來源至伺服器控制項的子控制項。Binds a data source to the server control's child controls.

(Inherited from Control)
DeleteItem(Int32) DeleteItem(Int32) DeleteItem(Int32) DeleteItem(Int32)

刪除資料來源中指定索引的資料錄。Deletes the record at the specified index from the data source.

Dispose() Dispose() Dispose() Dispose()

啟用伺服器控制項,在它從記憶體釋放之前執行最後清除。Enables a server control to perform final clean up before it is released from memory.

(Inherited from Control)
EndRenderTracing(TextWriter, Object) EndRenderTracing(TextWriter, Object) EndRenderTracing(TextWriter, Object) EndRenderTracing(TextWriter, Object)

結束轉譯資料的設計階段追蹤。Ends design-time tracing of rendering data.

(Inherited from Control)
EnsureChildControls() EnsureChildControls() EnsureChildControls() EnsureChildControls()

判斷伺服器控制項是否包含子控制項。Determines whether the server control contains child controls. 如果不包含,則建立子控制項。If it does not, it creates child controls.

(Inherited from Control)
EnsureDataBound() EnsureDataBound() EnsureDataBound() EnsureDataBound()

如果設定了 DataBind() 屬性且資料繫結控制項標記為需要繫結,則會呼叫 DataSourceID 方法。Calls the DataBind() method if the DataSourceID property is set and the data-bound control is marked to require binding.

(Inherited from BaseDataBoundControl)
EnsureID() EnsureID() EnsureID() EnsureID()

為尚未指定識別項的控制項,建立識別項。Creates an identifier for controls that do not have an identifier assigned.

(Inherited from Control)
EnsureLayoutTemplate() EnsureLayoutTemplate() EnsureLayoutTemplate() EnsureLayoutTemplate()

確定已在 LayoutTemplate 控制項中建立正確的 ListView 內容。Ensures that the LayoutTemplate content is correctly created in the ListView control.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
ExtractItemValues(IOrderedDictionary, ListViewItem, Boolean) ExtractItemValues(IOrderedDictionary, ListViewItem, Boolean) ExtractItemValues(IOrderedDictionary, ListViewItem, Boolean) ExtractItemValues(IOrderedDictionary, ListViewItem, Boolean)

擷取指定之項目中宣告的每一個欄位的值,並儲存在指定的 IOrderedDictionary 物件中。Retrieves the values of each field that is declared in the specified item, and stores them in the specified IOrderedDictionary object.

FindControl(String) FindControl(String) FindControl(String) FindControl(String)

在目前命名容器搜尋具有指定 id 參數的伺服器控制項。Searches the current naming container for a server control with the specified id parameter.

(Inherited from Control)
FindControl(String, Int32) FindControl(String, Int32) FindControl(String, Int32) FindControl(String, Int32)

使用指定的 id 和有助於搜尋之 pathOffset 參數中所指定的整數,在目前的命名容器中搜尋伺服器控制項。Searches the current naming container for a server control with the specified id and an integer, specified in the pathOffset parameter, which aids in the search. 您不應該覆寫這個版本的 FindControl 方法。You should not override this version of the FindControl method.

(Inherited from Control)
FindPlaceholder(String, Control) FindPlaceholder(String, Control) FindPlaceholder(String, Control) FindPlaceholder(String, Control)

在指定的容器中搜尋具有指定之識別項的控制項。Searches the specified container for a control that has the specified identifier.

Focus() Focus() Focus() Focus()

設定控制項的輸入焦點。Sets input focus to a control.

(Inherited from Control)
GetData() GetData() GetData() GetData()

擷取 DataSourceView 物件,資料繫結控制項會用來執行資料作業。Retrieves a DataSourceView object that the data-bound control uses to perform data operations.

(Inherited from DataBoundControl)
GetDataSource() GetDataSource() GetDataSource() GetDataSource()

擷取與資料繫結控制項關聯的 IDataSource 介面 (如果有的話)。Retrieves the IDataSource interface that the data-bound control is associated with, if any.

(Inherited from DataBoundControl)
GetDesignModeState() GetDesignModeState() GetDesignModeState() GetDesignModeState()

取得控制項的設計階段資料。Gets design-time data for a control.

(Inherited from Control)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetRouteUrl(Object) GetRouteUrl(Object) GetRouteUrl(Object) GetRouteUrl(Object)

取得會對應於一組路由參數的 URL。Gets the URL that corresponds to a set of route parameters.

(Inherited from Control)
GetRouteUrl(RouteValueDictionary) GetRouteUrl(RouteValueDictionary) GetRouteUrl(RouteValueDictionary) GetRouteUrl(RouteValueDictionary)

取得會對應於一組路由參數的 URL。Gets the URL that corresponds to a set of route parameters.

(Inherited from Control)
GetRouteUrl(String, Object) GetRouteUrl(String, Object) GetRouteUrl(String, Object) GetRouteUrl(String, Object)

取得 URL,此 URL 對應於一組路由參數及一個路由名稱。Gets the URL that corresponds to a set of route parameters and a route name.

(Inherited from Control)
GetRouteUrl(String, RouteValueDictionary) GetRouteUrl(String, RouteValueDictionary) GetRouteUrl(String, RouteValueDictionary) GetRouteUrl(String, RouteValueDictionary)

取得 URL,此 URL 對應於一組路由參數及一個路由名稱。Gets the URL that corresponds to a set of route parameters and a route name.

(Inherited from Control)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
GetUniqueIDRelativeTo(Control) GetUniqueIDRelativeTo(Control) GetUniqueIDRelativeTo(Control) GetUniqueIDRelativeTo(Control)

傳回指定之控制項 UniqueID 屬性的前置部分。Returns the prefixed portion of the UniqueID property of the specified control.

(Inherited from Control)
HasControls() HasControls() HasControls() HasControls()

判斷伺服器控制項是否包含任何子控制項。Determines if the server control contains any child controls.

(Inherited from Control)
HasEvents() HasEvents() HasEvents() HasEvents()

傳回值,指出控制項或任何子控制項的事件是否已註冊。Returns a value indicating whether events are registered for the control or any child controls.

(Inherited from Control)
InsertNewItem(Boolean) InsertNewItem(Boolean) InsertNewItem(Boolean) InsertNewItem(Boolean)

將目前的資料錄插入資料來源。Inserts the current record in the data source.

InstantiateEmptyDataTemplate(Control) InstantiateEmptyDataTemplate(Control) InstantiateEmptyDataTemplate(Control) InstantiateEmptyDataTemplate(Control)

使用 Control 樣板包含的子控制項,填入指定的 EmptyDataTemplate 物件。Populates the specified Control object by using the child controls that are contained in the EmptyDataTemplate template.

InstantiateEmptyItemTemplate(Control) InstantiateEmptyItemTemplate(Control) InstantiateEmptyItemTemplate(Control) InstantiateEmptyItemTemplate(Control)

使用 Control 樣板包含的子控制項,填入指定的 EmptyItemTemplate 物件。Populates the specified Control object by using the child controls that are contained in the EmptyItemTemplate template.

InstantiateGroupSeparatorTemplate(Control) InstantiateGroupSeparatorTemplate(Control) InstantiateGroupSeparatorTemplate(Control) InstantiateGroupSeparatorTemplate(Control)

使用 Control 樣板包含的子控制項,填入指定的 GroupSeparatorTemplate 物件。Populates the specified Control object by using the child controls that are contained in the GroupSeparatorTemplate template.

InstantiateGroupTemplate(Control) InstantiateGroupTemplate(Control) InstantiateGroupTemplate(Control) InstantiateGroupTemplate(Control)

使用 Control 樣板包含的子控制項,填入指定的 GroupTemplate 物件。Populates the specified Control object by using the child controls that are contained in the GroupTemplate template.

InstantiateInsertItemTemplate(Control) InstantiateInsertItemTemplate(Control) InstantiateInsertItemTemplate(Control) InstantiateInsertItemTemplate(Control)

使用 Control 樣板包含的子控制項,填入指定的 InsertItemTemplate 物件。Populates the specified Control object by using the child controls that are contained in the InsertItemTemplate template.

InstantiateItemSeparatorTemplate(Control) InstantiateItemSeparatorTemplate(Control) InstantiateItemSeparatorTemplate(Control) InstantiateItemSeparatorTemplate(Control)

使用 Control 樣板包含的子控制項,填入指定的 ItemSeparatorTemplate 物件。Populates the specified Control object by using the child controls that are contained in the ItemSeparatorTemplate template.

InstantiateItemTemplate(Control, Int32) InstantiateItemTemplate(Control, Int32) InstantiateItemTemplate(Control, Int32) InstantiateItemTemplate(Control, Int32)

使用其中一個 Control 控制項樣板中的子控制項,填入指定的 ListView 物件。Populates the specified Control object by using child controls from one of the ListView control templates.

IsLiteralContent() IsLiteralContent() IsLiteralContent() IsLiteralContent()

判斷伺服器控制項是否只儲存常值內容。Determines if the server control holds only literal content.

(Inherited from Control)
LoadControlState(Object) LoadControlState(Object) LoadControlState(Object) LoadControlState(Object)

載入 ListView 控制項中必須保存的屬性狀態,即使 EnableViewState 屬性設定為 false 也一樣。Loads the state of the properties in the ListView control that must be persisted, even when the EnableViewState property is set to false.

LoadViewState(Object) LoadViewState(Object) LoadViewState(Object) LoadViewState(Object)

載入先前儲存的 ListView 控制項檢視狀態。Loads the previously saved view state of the ListView control.

MapPathSecure(String) MapPathSecure(String) MapPathSecure(String) MapPathSecure(String)

擷取虛擬絕對路徑或相對路徑所對應至的實體路徑。Retrieves the physical path that a virtual path, either absolute or relative, maps to.

(Inherited from Control)
MarkAsDataBound() MarkAsDataBound() MarkAsDataBound() MarkAsDataBound()

將檢視狀態中的控制項狀態設為已成功繫結至資料。Sets the state of the control in view state as successfully bound to data.

(Inherited from DataBoundControl)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
MergeStyle(Style) MergeStyle(Style) MergeStyle(Style) MergeStyle(Style)

將指定樣式的任何非空白項目複製到 Web 控制項,但不覆寫控制項的任何現有樣式項目。Copies any nonblank elements of the specified style to the Web control, but will not overwrite any existing style elements of the control. 這個方法主要由控制項開發人員使用。This method is used primarily by control developers.

(Inherited from WebControl)
OnBubbleEvent(Object, EventArgs) OnBubbleEvent(Object, EventArgs) OnBubbleEvent(Object, EventArgs) OnBubbleEvent(Object, EventArgs)

決定是否應該處理 ListView 控制項的事件。Determines whether an event for the ListView control should be handled.

OnCreatingModelDataSource(CreatingModelDataSourceEventArgs) OnCreatingModelDataSource(CreatingModelDataSourceEventArgs) OnCreatingModelDataSource(CreatingModelDataSourceEventArgs) OnCreatingModelDataSource(CreatingModelDataSourceEventArgs)

引發 CreatingModelDataSource 事件。Raises the CreatingModelDataSource event.

(Inherited from DataBoundControl)
OnDataBinding(EventArgs) OnDataBinding(EventArgs) OnDataBinding(EventArgs) OnDataBinding(EventArgs)

引發 DataBinding 事件。Raises the DataBinding event.

(Inherited from Control)
OnDataBound(EventArgs) OnDataBound(EventArgs) OnDataBound(EventArgs) OnDataBound(EventArgs)

引發 DataBound 事件。Raises the DataBound event.

(Inherited from BaseDataBoundControl)
OnDataPropertyChanged() OnDataPropertyChanged() OnDataPropertyChanged() OnDataPropertyChanged()

其中一個基底資料來源識別屬性變更之後,將資料繫結控制項重新繫結至其資料。Rebinds the data-bound control to its data after one of the base data source identification properties changes.

(Inherited from DataBoundControl)
OnDataSourceViewChanged(Object, EventArgs) OnDataSourceViewChanged(Object, EventArgs) OnDataSourceViewChanged(Object, EventArgs) OnDataSourceViewChanged(Object, EventArgs)

引發 DataSourceViewChanged 事件。Raises the DataSourceViewChanged event.

(Inherited from DataBoundControl)
OnInit(EventArgs) OnInit(EventArgs) OnInit(EventArgs) OnInit(EventArgs)

引發 Init 事件。Raises the Init event.

OnItemCanceling(ListViewCancelEventArgs) OnItemCanceling(ListViewCancelEventArgs) OnItemCanceling(ListViewCancelEventArgs) OnItemCanceling(ListViewCancelEventArgs)

引發 ItemCanceling 事件。Raises the ItemCanceling event.

OnItemCommand(ListViewCommandEventArgs) OnItemCommand(ListViewCommandEventArgs) OnItemCommand(ListViewCommandEventArgs) OnItemCommand(ListViewCommandEventArgs)

引發 ItemCommand 事件。Raises the ItemCommand event.

OnItemCreated(ListViewItemEventArgs) OnItemCreated(ListViewItemEventArgs) OnItemCreated(ListViewItemEventArgs) OnItemCreated(ListViewItemEventArgs)

引發 ItemCreated 事件。Raises the ItemCreated event.

OnItemDataBound(ListViewItemEventArgs) OnItemDataBound(ListViewItemEventArgs) OnItemDataBound(ListViewItemEventArgs) OnItemDataBound(ListViewItemEventArgs)

引發 ItemDataBound 事件。Raises the ItemDataBound event.

OnItemDeleted(ListViewDeletedEventArgs) OnItemDeleted(ListViewDeletedEventArgs) OnItemDeleted(ListViewDeletedEventArgs) OnItemDeleted(ListViewDeletedEventArgs)

引發 ItemDeleted 事件。Raises the ItemDeleted event.

OnItemDeleting(ListViewDeleteEventArgs) OnItemDeleting(ListViewDeleteEventArgs) OnItemDeleting(ListViewDeleteEventArgs) OnItemDeleting(ListViewDeleteEventArgs)

引發 ItemDeleting 事件。Raises the ItemDeleting event.

OnItemEditing(ListViewEditEventArgs) OnItemEditing(ListViewEditEventArgs) OnItemEditing(ListViewEditEventArgs) OnItemEditing(ListViewEditEventArgs)

引發 ItemEditing 事件。Raises the ItemEditing event.

OnItemInserted(ListViewInsertedEventArgs) OnItemInserted(ListViewInsertedEventArgs) OnItemInserted(ListViewInsertedEventArgs) OnItemInserted(ListViewInsertedEventArgs)

引發 ItemInserted 事件。Raises the ItemInserted event.

OnItemInserting(ListViewInsertEventArgs) OnItemInserting(ListViewInsertEventArgs) OnItemInserting(ListViewInsertEventArgs) OnItemInserting(ListViewInsertEventArgs)

引發 ItemInserting 事件。Raises the ItemInserting event.

OnItemUpdated(ListViewUpdatedEventArgs) OnItemUpdated(ListViewUpdatedEventArgs) OnItemUpdated(ListViewUpdatedEventArgs) OnItemUpdated(ListViewUpdatedEventArgs)

引發 ItemUpdated 事件。Raises the ItemUpdated event.

OnItemUpdating(ListViewUpdateEventArgs) OnItemUpdating(ListViewUpdateEventArgs) OnItemUpdating(ListViewUpdateEventArgs) OnItemUpdating(ListViewUpdateEventArgs)

引發 ItemUpdating 事件。Raises the ItemUpdating event.

OnLayoutCreated(EventArgs) OnLayoutCreated(EventArgs) OnLayoutCreated(EventArgs) OnLayoutCreated(EventArgs)

引發 LayoutCreated 事件。Raises the LayoutCreated event.

OnLoad(EventArgs) OnLoad(EventArgs) OnLoad(EventArgs) OnLoad(EventArgs)

處理 Load 事件。Handles the Load event.

(Inherited from DataBoundControl)
OnPagePreLoad(Object, EventArgs) OnPagePreLoad(Object, EventArgs) OnPagePreLoad(Object, EventArgs) OnPagePreLoad(Object, EventArgs)

設定資料繫結控制項在載入控制項之前的初始化狀態。Sets the initialized state of the data-bound control before the control is loaded.

(Inherited from DataBoundControl)
OnPagePropertiesChanged(EventArgs) OnPagePropertiesChanged(EventArgs) OnPagePropertiesChanged(EventArgs) OnPagePropertiesChanged(EventArgs)

引發 PagePropertiesChanged 事件。Raises the PagePropertiesChanged event.

OnPagePropertiesChanging(PagePropertiesChangingEventArgs) OnPagePropertiesChanging(PagePropertiesChangingEventArgs) OnPagePropertiesChanging(PagePropertiesChangingEventArgs) OnPagePropertiesChanging(PagePropertiesChangingEventArgs)

引發 PagePropertiesChanging 事件。Raises the PagePropertiesChanging event.

OnPreRender(EventArgs) OnPreRender(EventArgs) OnPreRender(EventArgs) OnPreRender(EventArgs)

處理 PreRender 事件。Handles the PreRender event.

(Inherited from BaseDataBoundControl)
OnSelectedIndexChanged(EventArgs) OnSelectedIndexChanged(EventArgs) OnSelectedIndexChanged(EventArgs) OnSelectedIndexChanged(EventArgs)

引發 SelectedIndexChanged 事件。Raises the SelectedIndexChanged event.

OnSelectedIndexChanging(ListViewSelectEventArgs) OnSelectedIndexChanging(ListViewSelectEventArgs) OnSelectedIndexChanging(ListViewSelectEventArgs) OnSelectedIndexChanging(ListViewSelectEventArgs)

引發 SelectedIndexChanging 事件。Raises the SelectedIndexChanging event.

OnSorted(EventArgs) OnSorted(EventArgs) OnSorted(EventArgs) OnSorted(EventArgs)

引發 Sorted 事件。Raises the Sorted event.

OnSorting(ListViewSortEventArgs) OnSorting(ListViewSortEventArgs) OnSorting(ListViewSortEventArgs) OnSorting(ListViewSortEventArgs)

引發 Sorting 事件。Raises the Sorting event.

OnTotalRowCountAvailable(PageEventArgs) OnTotalRowCountAvailable(PageEventArgs) OnTotalRowCountAvailable(PageEventArgs) OnTotalRowCountAvailable(PageEventArgs)

引發 IPageableItemContainer.TotalRowCountAvailable 事件。Raises the IPageableItemContainer.TotalRowCountAvailable event.

OnUnload(EventArgs) OnUnload(EventArgs) OnUnload(EventArgs) OnUnload(EventArgs)

引發 Unload 事件。Raises the Unload event.

(Inherited from Control)
OpenFile(String) OpenFile(String) OpenFile(String) OpenFile(String)

取得用來讀取檔案的 StreamGets a Stream used to read a file.

(Inherited from Control)
PerformDataBinding(IEnumerable) PerformDataBinding(IEnumerable) PerformDataBinding(IEnumerable) PerformDataBinding(IEnumerable)

ListView 控制項繫結至指定的資料來源。Binds the ListView control to the specified data source.

PerformSelect() PerformSelect() PerformSelect() PerformSelect()

從關聯的資料來源擷取資料。Retrieves data from the associated data source.

RaiseBubbleEvent(Object, EventArgs) RaiseBubbleEvent(Object, EventArgs) RaiseBubbleEvent(Object, EventArgs) RaiseBubbleEvent(Object, EventArgs)

指派事件的任何來源和它的資訊至控制項的父控制項。Assigns any sources of the event and its information to the control's parent.

(Inherited from Control)
RemovedControl(Control) RemovedControl(Control) RemovedControl(Control) RemovedControl(Control)

Control 物件的 Controls 集合中移除子控制項之後呼叫。Called after a child control is removed from the Controls collection of the Control object.

(Inherited from Control)
RemoveItems() RemoveItems() RemoveItems() RemoveItems()

刪除 ListView 控制項的項目容器或群組容器中的所有子控制項。Deletes all child controls in an item or group container of the ListView control.

Render(HtmlTextWriter) Render(HtmlTextWriter) Render(HtmlTextWriter) Render(HtmlTextWriter)

使用指定的 HtmlTextWriter 物件,向用戶端瀏覽器呈現 Web 伺服器控制項內容。Renders the Web server control content to the client's browser by using the specified HtmlTextWriter object.

RenderBeginTag(HtmlTextWriter) RenderBeginTag(HtmlTextWriter) RenderBeginTag(HtmlTextWriter) RenderBeginTag(HtmlTextWriter)

將控制項的 HTML 開頭標記呈現在指定的寫入器中。Renders the HTML opening tag of the control to the specified writer. 這個方法主要由控制項開發人員使用。This method is used primarily by control developers.

(Inherited from WebControl)
RenderChildren(HtmlTextWriter) RenderChildren(HtmlTextWriter) RenderChildren(HtmlTextWriter) RenderChildren(HtmlTextWriter)

輸出伺服器控制項之子控制項的內容至提供的 HtmlTextWriter 物件,這個物件會寫入用戶端上所要呈現的內容。Outputs the content of a server control's children to a provided HtmlTextWriter object, which writes the content to be rendered on the client.

(Inherited from Control)
RenderContents(HtmlTextWriter) RenderContents(HtmlTextWriter) RenderContents(HtmlTextWriter) RenderContents(HtmlTextWriter)

將控制項的內容呈現在指定的寫入器。Renders the contents of the control to the specified writer. 這個方法主要由控制項開發人員使用。This method is used primarily by control developers.

(Inherited from WebControl)
RenderControl(HtmlTextWriter) RenderControl(HtmlTextWriter) RenderControl(HtmlTextWriter) RenderControl(HtmlTextWriter)

將伺服器控制項內容輸出至提供的 HtmlTextWriter 物件,並在啟用追蹤時儲存控制項的追蹤資訊。Outputs server control content to a provided HtmlTextWriter object and stores tracing information about the control if tracing is enabled.

(Inherited from Control)
RenderControl(HtmlTextWriter, ControlAdapter) RenderControl(HtmlTextWriter, ControlAdapter) RenderControl(HtmlTextWriter, ControlAdapter) RenderControl(HtmlTextWriter, ControlAdapter)

使用提供的 HtmlTextWriter 物件,輸出伺服器控制項內容至提供的 ControlAdapter 物件。Outputs server control content to a provided HtmlTextWriter object using a provided ControlAdapter object.

(Inherited from Control)
RenderEndTag(HtmlTextWriter) RenderEndTag(HtmlTextWriter) RenderEndTag(HtmlTextWriter) RenderEndTag(HtmlTextWriter)

將控制項的 HTML 結尾標記呈現至指定的寫入器。Renders the HTML closing tag of the control into the specified writer. 這個方法主要由控制項開發人員使用。This method is used primarily by control developers.

(Inherited from WebControl)
ResolveAdapter() ResolveAdapter() ResolveAdapter() ResolveAdapter()

取得負責呈現指定之控制項的控制項配置器。Gets the control adapter responsible for rendering the specified control.

(Inherited from Control)
ResolveClientUrl(String) ResolveClientUrl(String) ResolveClientUrl(String) ResolveClientUrl(String)

取得瀏覽器可使用的 URL。Gets a URL that can be used by the browser.

(Inherited from Control)
ResolveUrl(String) ResolveUrl(String) ResolveUrl(String) ResolveUrl(String)

將 URL 轉換為要求用戶端可使用的 URL。Converts a URL into one that is usable on the requesting client.

(Inherited from Control)
SaveControlState() SaveControlState() SaveControlState() SaveControlState()

儲存 ListView 控制項中需要保存的屬性狀態,即使 EnableViewState 屬性設定為 false 也一樣。Saves the state of the properties in the ListView control that must be persisted, even when the EnableViewState property is set to false.

SaveViewState() SaveViewState() SaveViewState() SaveViewState()

儲存 ListView 控制項的目前檢視狀態。Saves the current view state of the ListView control.

SelectItem(Int32) SelectItem(Int32) SelectItem(Int32) SelectItem(Int32)

選取 ListView 控制項中處於編輯模式的項目。Selects the item that is in edit mode in a ListView control.

SetDesignModeState(IDictionary) SetDesignModeState(IDictionary) SetDesignModeState(IDictionary) SetDesignModeState(IDictionary)

設定控制項的設計階段資料。Sets design-time data for a control.

(Inherited from Control)
SetEditItem(Int32) SetEditItem(Int32) SetEditItem(Int32) SetEditItem(Int32)

ListView 控制項中指定的項目設為編輯模式。Sets the specified item into edit mode in a ListView control.

SetPageProperties(Int32, Int32, Boolean) SetPageProperties(Int32, Int32, Boolean) SetPageProperties(Int32, Int32, Boolean) SetPageProperties(Int32, Int32, Boolean)

設定 ListView 控制項中資料頁的屬性。Sets the properties of a page of data in the ListView control.

SetRenderMethodDelegate(RenderMethod) SetRenderMethodDelegate(RenderMethod) SetRenderMethodDelegate(RenderMethod) SetRenderMethodDelegate(RenderMethod)

指定事件處理常式委派,以呈現伺服器控制項及其內容至其父控制項。Assigns an event handler delegate to render the server control and its content into its parent control.

(Inherited from Control)
SetTraceData(Object, Object) SetTraceData(Object, Object) SetTraceData(Object, Object) SetTraceData(Object, Object)

使用追蹤資料機碼和追蹤資料值,設定設計階段期間追蹤呈現資料的追蹤資料。Sets trace data for design-time tracing of rendering data, using the trace data key and the trace data value.

(Inherited from Control)
SetTraceData(Object, Object, Object) SetTraceData(Object, Object, Object) SetTraceData(Object, Object, Object) SetTraceData(Object, Object, Object)

使用追蹤的物體、追蹤資料機碼和追蹤資料值,設定設計階段期間追蹤呈現資料的追蹤資料。Sets trace data for design-time tracing of rendering data, using the traced object, the trace data key, and the trace data value.

(Inherited from Control)
Sort(String, SortDirection) Sort(String, SortDirection) Sort(String, SortDirection) Sort(String, SortDirection)

根據指定的排序運算式和方向,排序 ListView 控制項。Sorts the ListView control, depending on the specified sort expression and direction.

ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)
TrackViewState() TrackViewState() TrackViewState() TrackViewState()

導致對控制項的檢視狀態變更進行追蹤,以便它們能夠儲存於控制項的 StateBag 物件。Causes view-state changes to the control to be tracked so they can be stored in the control's StateBag object.

(Inherited from DataBoundControl)
UpdateItem(Int32, Boolean) UpdateItem(Int32, Boolean) UpdateItem(Int32, Boolean) UpdateItem(Int32, Boolean)

在資料來源中更新指定之索引上的資料錄。Updates the record at the specified index in the data source.

ValidateDataSource(Object) ValidateDataSource(Object) ValidateDataSource(Object) ValidateDataSource(Object)

驗證資料繫結控制項繫結至的物件是該資料繫結控制項所使用的物件。Verifies that the object a data-bound control binds to is one it can work with.

(Inherited from DataBoundControl)

事件

CallingDataMethods CallingDataMethods CallingDataMethods CallingDataMethods

正在呼叫資料方法時發生。Occurs when data methods are being called.

(Inherited from DataBoundControl)
CreatingModelDataSource CreatingModelDataSource CreatingModelDataSource CreatingModelDataSource

正在建立 ModelDataSource 物件時發生。Occurs when the ModelDataSource object is being created.

(Inherited from DataBoundControl)
DataBinding DataBinding DataBinding DataBinding

發生於伺服器控制項繫結至資料來源時。Occurs when the server control binds to a data source.

(Inherited from Control)
DataBound DataBound DataBound DataBound

在伺服器控制項繫結至資料來源之後發生。Occurs after the server control binds to a data source.

(Inherited from BaseDataBoundControl)
Disposed Disposed Disposed Disposed

發生於伺服器控制項從記憶體釋放時,這是在要求 ASP.NET 網頁時,伺服器控制項生命週期的最後階段。Occurs when a server control is released from memory, which is the last stage of the server control lifecycle when an ASP.NET page is requested.

(Inherited from Control)
Init Init Init Init

發生於初始化伺服器控制項時,是其生命週期中的第一個步驟。Occurs when the server control is initialized, which is the first step in its lifecycle.

(Inherited from Control)
ItemCanceling ItemCanceling ItemCanceling ItemCanceling

當要求取消作業時,但是在 ListView 控制項取消插入或編輯作業之前發生。Occurs when a cancel operation is requested, but before the ListView control cancels the insert or edit operation.

ItemCommand ItemCommand ItemCommand ItemCommand

當按一下 ListView 控制項中的按鈕時發生。Occurs when a button in a ListView control is clicked.

ItemCreated ItemCreated ItemCreated ItemCreated

ListView 控制項中建立項目時發生。Occurs when an item is created in a ListView control.

ItemDataBound ItemDataBound ItemDataBound ItemDataBound

當資料項目繫結至 ListView 控制項中的資料時發生。Occurs when a data item is bound to data in a ListView control.

ItemDeleted ItemDeleted ItemDeleted ItemDeleted

當要求刪除作業時,在 ListView 控制項刪除項目之後發生。Occurs when a delete operation is requested, after the ListView control deletes the item.

ItemDeleting ItemDeleting ItemDeleting ItemDeleting

當要求刪除作業時,但是在 ListView 控制項刪除項目之前發生。Occurs when a delete operation is requested, but before the ListView control deletes the item.

ItemEditing ItemEditing ItemEditing ItemEditing

當要求編輯作業時,在 ListView 項目進入編輯模式之前發生。Occurs when an edit operation is requested, but before the ListView item is put in edit mode.

ItemInserted ItemInserted ItemInserted ItemInserted

當要求插入作業時,在 ListView 控制項將項目插入資料來源之後發生。Occurs when an insert operation is requested, after the ListView control has inserted the item in the data source.

ItemInserting ItemInserting ItemInserting ItemInserting

當要求插入作業時,但是在 ListView 控制項執行插入之前發生。Occurs when an insert operation is requested, but before the ListView control performs the insert.

ItemUpdated ItemUpdated ItemUpdated ItemUpdated

當要求更新作業時,在 ListView 控制項更新項目之後發生。Occurs when an update operation is requested, after the ListView control updates the item.

ItemUpdating ItemUpdating ItemUpdating ItemUpdating

當要求更新作業時,但是在 ListView 控制項更新項目之前發生。Occurs when an update operation is requested, but before the ListView control updates the item.

LayoutCreated LayoutCreated LayoutCreated LayoutCreated

LayoutTemplate 控制項中建立 ListView 樣板時發生。Occurs when the LayoutTemplate template is created in a ListView control.

Load Load Load Load

發生於載入伺服器控制項至 Page 物件時。Occurs when the server control is loaded into the Page object.

(Inherited from Control)
PagePropertiesChanged PagePropertiesChanged PagePropertiesChanged PagePropertiesChanged

當頁面屬性變更時,在 ListView 控制項設定新的值之後發生。Occurs when the page properties change, after the ListView control sets the new values.

PagePropertiesChanging PagePropertiesChanging PagePropertiesChanging PagePropertiesChanging

當頁面屬性變更時,但是在 ListView 控制項設定新的值之前發生。Occurs when the page properties change, but before the ListView control sets the new values.

PreRender PreRender PreRender PreRender

Control 物件載入之後但在呈現之前發生。Occurs after the Control object is loaded but prior to rendering.

(Inherited from Control)
SelectedIndexChanged SelectedIndexChanged SelectedIndexChanged SelectedIndexChanged

當按一下項目的 [選取] 按鈕時,在 ListView 控制項處理選取作業之後發生。Occurs when an item's Select button is clicked, after the ListView control handles the select operation.

SelectedIndexChanging SelectedIndexChanging SelectedIndexChanging SelectedIndexChanging

當按一下項目的 [選取] 按鈕時,但是在 ListView 控制項處理選取作業之後發生。Occurs when an item's Select button is clicked, but before the ListView control handles the select operation.

Sorted Sorted Sorted Sorted

當要求排序作業時,在 ListView 控制項處理排序作業之後發生。Occurs when a sort operation is requested, after the ListView control handles the sort operation.

Sorting Sorting Sorting Sorting

當要求排序作業時,但是在 ListView 控制項處理排序作業之前發生。Occurs when a sort operation is requested, but before the ListView control handles the sort operation.

Unload Unload Unload Unload

發生於伺服器控制項從記憶體卸載時。Occurs when the server control is unloaded from memory.

(Inherited from Control)

明確介面實作

IAttributeAccessor.GetAttribute(String) IAttributeAccessor.GetAttribute(String) IAttributeAccessor.GetAttribute(String) IAttributeAccessor.GetAttribute(String)

使用指定的名稱,取得 Web 控制項的屬性。Gets an attribute of the Web control with the specified name.

(Inherited from WebControl)
IAttributeAccessor.SetAttribute(String, String) IAttributeAccessor.SetAttribute(String, String) IAttributeAccessor.SetAttribute(String, String) IAttributeAccessor.SetAttribute(String, String)

將 Web 控制項的屬性設定為指定的名稱和值。Sets an attribute of the Web control to the specified name and value.

(Inherited from WebControl)
IControlDesignerAccessor.GetDesignModeState() IControlDesignerAccessor.GetDesignModeState() IControlDesignerAccessor.GetDesignModeState() IControlDesignerAccessor.GetDesignModeState()

如需這個成員的說明,請參閱 GetDesignModeState()For a description of this member, see GetDesignModeState().

(Inherited from Control)
IControlDesignerAccessor.SetDesignModeState(IDictionary) IControlDesignerAccessor.SetDesignModeState(IDictionary) IControlDesignerAccessor.SetDesignModeState(IDictionary) IControlDesignerAccessor.SetDesignModeState(IDictionary)

如需這個成員的說明,請參閱 SetDesignModeState(IDictionary)For a description of this member, see SetDesignModeState(IDictionary).

(Inherited from Control)
IControlDesignerAccessor.SetOwnerControl(Control) IControlDesignerAccessor.SetOwnerControl(Control) IControlDesignerAccessor.SetOwnerControl(Control) IControlDesignerAccessor.SetOwnerControl(Control)

如需這個成員的說明,請參閱 SetOwnerControl(Control)For a description of this member, see SetOwnerControl(Control).

(Inherited from Control)
IDataBoundControl.DataKeyNames IDataBoundControl.DataKeyNames IDataBoundControl.DataKeyNames IDataBoundControl.DataKeyNames

取得或設定陣列,這個陣列包含資料繫結控制項中所顯示項目的主索引鍵欄位名稱。Gets or sets an array that contains the names of the primary-key fields of the items that are displayed in a data-bound control.

IDataBoundControl.DataMember IDataBoundControl.DataMember IDataBoundControl.DataMember IDataBoundControl.DataMember

取得或設定資料清單的名稱,當資料來源包含多個不同資料項目清單時,資料繫結控制項會繫結至這個資料清單。Gets or sets the name of the list of data that the data-bound control binds to when the data source contains more than one distinct list of data items.

IDataBoundControl.DataSource IDataBoundControl.DataSource IDataBoundControl.DataSource IDataBoundControl.DataSource

取得或設定物件,資料繫結控制項會從這個物件擷取資料項目清單。Gets or sets the object from which a data-bound control retrieves its list of data items.

IDataBoundControl.DataSourceID IDataBoundControl.DataSourceID IDataBoundControl.DataSourceID IDataBoundControl.DataSourceID

取得或設定資料來源控制項的 ID,資料繫結控制項會從這個資料來源控制項擷取資料項目清單。Gets or sets the ID of the data source control from which a data-bound control retrieves its list of data items.

IDataBoundControl.DataSourceObject IDataBoundControl.DataSourceObject IDataBoundControl.DataSourceObject IDataBoundControl.DataSourceObject

取得物件,這個物件會實作可提供物件資料內容之存取權的 IDataSource 介面。Gets an object that implements the IDataSource interface, which provides access to the object's data content.

IDataBoundListControl.ClientIDRowSuffix IDataBoundListControl.ClientIDRowSuffix IDataBoundListControl.ClientIDRowSuffix IDataBoundListControl.ClientIDRowSuffix

取得資料欄位的名稱,這個資料欄位的值會在 ListView 屬性設為 ClientIDMode 時,用來識別 Predictable 控制項的每個唯一的資料列。Gets the name of the data field whose value is used to uniquely identify each data row of a ListView control when the ClientIDMode property is set to Predictable.

IDataBoundListControl.DataKeys IDataBoundListControl.DataKeys IDataBoundListControl.DataKeys IDataBoundListControl.DataKeys

取得資料索引鍵值的集合,這些資料索引鍵值表示資料繫結控制項中的每個資料列。Gets a collection of data-key values that represent each row in a data-bound control.

IDataBoundListControl.EnablePersistedSelection IDataBoundListControl.EnablePersistedSelection IDataBoundListControl.EnablePersistedSelection IDataBoundListControl.EnablePersistedSelection

取得或設定值,這個值指定當使用者逐頁巡覽資料繫結控制項中的資料時,是否保存某個資料列的選取狀態。Gets or sets the value that specifies whether a selected row persists when a user pages through data in a data-bound control.

IDataBoundListControl.SelectedDataKey IDataBoundListControl.SelectedDataKey IDataBoundListControl.SelectedDataKey IDataBoundListControl.SelectedDataKey

取得資料索引鍵物件,這個物件包含資料繫結控制項中所選取資料列的資料索引鍵值。Gets the data-key object that contains the data-key value for the selected row in a data-bound control.

IDataBoundListControl.SelectedIndex IDataBoundListControl.SelectedIndex IDataBoundListControl.SelectedIndex IDataBoundListControl.SelectedIndex

取得或設定資料繫結控制項中所選取資料列的索引。Gets or sets the index of the selected row in a data-bound control.

IDataKeysControl.ClientIDRowSuffixDataKeys IDataKeysControl.ClientIDRowSuffixDataKeys IDataKeysControl.ClientIDRowSuffixDataKeys IDataKeysControl.ClientIDRowSuffixDataKeys

取得資料值集合,這些值會在 ASP.NET 產生 ClientID 值時,用來識別資料繫結控制項的每個唯一的執行個體。Gets a collection of the data values that are used to uniquely identify each instance of a data-bound control when ASP.NET generates the ClientID value.

IPageableItemContainer.MaximumRows IPageableItemContainer.MaximumRows IPageableItemContainer.MaximumRows IPageableItemContainer.MaximumRows

如需這個成員的說明,請參閱 MaximumRowsFor a description of this member, see MaximumRows.

IPageableItemContainer.SetPageProperties(Int32, Int32, Boolean) IPageableItemContainer.SetPageProperties(Int32, Int32, Boolean) IPageableItemContainer.SetPageProperties(Int32, Int32, Boolean) IPageableItemContainer.SetPageProperties(Int32, Int32, Boolean)

如需這個成員的說明,請參閱 SetPageProperties(Int32, Int32, Boolean)For a description of this member, see SetPageProperties(Int32, Int32, Boolean).

IPageableItemContainer.StartRowIndex IPageableItemContainer.StartRowIndex IPageableItemContainer.StartRowIndex IPageableItemContainer.StartRowIndex

如需這個成員的說明,請參閱 StartRowIndexFor a description of this member, see StartRowIndex.

IPageableItemContainer.TotalRowCountAvailable IPageableItemContainer.TotalRowCountAvailable IPageableItemContainer.TotalRowCountAvailable IPageableItemContainer.TotalRowCountAvailable

如需這個成員的說明,請參閱 TotalRowCountAvailableFor a description of this member, see TotalRowCountAvailable.

IParserAccessor.AddParsedSubObject(Object) IParserAccessor.AddParsedSubObject(Object) IParserAccessor.AddParsedSubObject(Object) IParserAccessor.AddParsedSubObject(Object)

如需這個成員的說明,請參閱 AddParsedSubObject(Object)For a description of this member, see AddParsedSubObject(Object).

(Inherited from Control)
IPersistedSelector.DataKey IPersistedSelector.DataKey IPersistedSelector.DataKey IPersistedSelector.DataKey

取得或設定資料繫結控制項中所選取資料錄的資料索引鍵值。Gets or sets the data-key value for the selected record in a data-bound control.

IWizardSideBarListControl.Items IWizardSideBarListControl.Items IWizardSideBarListControl.Items IWizardSideBarListControl.Items

擴充方法

EnablePersistedSelection(BaseDataBoundControl) EnablePersistedSelection(BaseDataBoundControl) EnablePersistedSelection(BaseDataBoundControl) EnablePersistedSelection(BaseDataBoundControl)

啟用要保存於資料控制項中且支援選取和分頁的選項。Enables selection to be persisted in data controls that support selection and paging.

FindDataSourceControl(Control) FindDataSourceControl(Control) FindDataSourceControl(Control) FindDataSourceControl(Control)

傳回與指定之控制項的資料控制項相關聯的資料來源。Returns the data source that is associated with the data control for the specified control.

FindFieldTemplate(Control, String) FindFieldTemplate(Control, String) FindFieldTemplate(Control, String) FindFieldTemplate(Control, String)

傳回在指定之控制項的命名容器中所指定資料行的欄位樣板。Returns the field template for the specified column in the specified control's naming container.

FindMetaTable(Control) FindMetaTable(Control) FindMetaTable(Control) FindMetaTable(Control)

傳回包含資料控制項的中繼資料表物件。Returns the metatable object for the containing data control.

GetDefaultValues(INamingContainer) GetDefaultValues(INamingContainer) GetDefaultValues(INamingContainer) GetDefaultValues(INamingContainer)

取得所指定資料控制項的預設值集合。Gets the collection of the default values for the specified data control.

GetMetaTable(INamingContainer) GetMetaTable(INamingContainer) GetMetaTable(INamingContainer) GetMetaTable(INamingContainer)

取得所指定資料控制項中的資料表中繼資料。Gets the table metadata for the specified data control.

SetMetaTable(INamingContainer, MetaTable) SetMetaTable(INamingContainer, MetaTable) SetMetaTable(INamingContainer, MetaTable) SetMetaTable(INamingContainer, MetaTable)

設定所指定資料控制項中的資料表中繼資料。Sets the table metadata for the specified data control.

SetMetaTable(INamingContainer, MetaTable, IDictionary<String,Object>) SetMetaTable(INamingContainer, MetaTable, IDictionary<String,Object>) SetMetaTable(INamingContainer, MetaTable, IDictionary<String,Object>) SetMetaTable(INamingContainer, MetaTable, IDictionary<String,Object>)

設定所指定資料控制項的資料表中繼資料及預設值對應。Sets the table metadata and default value mapping for the specified data control.

SetMetaTable(INamingContainer, MetaTable, Object) SetMetaTable(INamingContainer, MetaTable, Object) SetMetaTable(INamingContainer, MetaTable, Object) SetMetaTable(INamingContainer, MetaTable, Object)

設定所指定資料控制項的資料表中繼資料及預設值對應。Sets the table metadata and default value mapping for the specified data control.

TryGetMetaTable(INamingContainer, MetaTable) TryGetMetaTable(INamingContainer, MetaTable) TryGetMetaTable(INamingContainer, MetaTable) TryGetMetaTable(INamingContainer, MetaTable)

判斷資料表中繼資料是否可供使用。Determines whether table metadata is available.

EnableDynamicData(INamingContainer, Type) EnableDynamicData(INamingContainer, Type) EnableDynamicData(INamingContainer, Type) EnableDynamicData(INamingContainer, Type)

針對指定的資料控制項啟用動態資料行為。Enables Dynamic Data behavior for the specified data control.

EnableDynamicData(INamingContainer, Type, IDictionary<String,Object>) EnableDynamicData(INamingContainer, Type, IDictionary<String,Object>) EnableDynamicData(INamingContainer, Type, IDictionary<String,Object>) EnableDynamicData(INamingContainer, Type, IDictionary<String,Object>)

針對指定的資料控制項啟用動態資料行為。Enables Dynamic Data behavior for the specified data control.

EnableDynamicData(INamingContainer, Type, Object) EnableDynamicData(INamingContainer, Type, Object) EnableDynamicData(INamingContainer, Type, Object) EnableDynamicData(INamingContainer, Type, Object)

針對指定的資料控制項啟用動態資料行為。Enables Dynamic Data behavior for the specified data control.

適用於

另請參閱