ListView 类

定义

通过使用用户定义的模板来显示数据源的值。 ListView 控件使用户可以选择、删除、编辑、插入记录及对其进行排序。

public ref class ListView : System::Web::UI::WebControls::DataBoundControl, System::Web::UI::INamingContainer, System::Web::UI::WebControls::IPageableItemContainer, System::Web::UI::WebControls::IPersistedSelector
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.ico")]
[System.Web.UI.ControlValueProperty("SelectedValue")]
public class ListView : System.Web.UI.WebControls.DataBoundControl, System.Web.UI.INamingContainer, System.Web.UI.WebControls.IPageableItemContainer, System.Web.UI.WebControls.IPersistedSelector
[System.Web.UI.ControlValueProperty("SelectedValue")]
[System.Drawing.ToolboxBitmap(typeof(System.Web.UI.WebControls.ListView), "ListView.bmp")]
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
[<System.Drawing.ToolboxBitmap(typeof(System.Web.UI.WebControls.ListView), "ListView.ico")>]
[<System.Web.UI.ControlValueProperty("SelectedValue")>]
type ListView = class
    inherit DataBoundControl
    interface INamingContainer
    interface IPageableItemContainer
    interface IPersistedSelector
[<System.Web.UI.ControlValueProperty("SelectedValue")>]
[<System.Drawing.ToolboxBitmap(typeof(System.Web.UI.WebControls.ListView), "ListView.bmp")>]
type ListView = class
    inherit DataBoundControl
    interface INamingContainer
    interface IPageableItemContainer
    interface IPersistedSelector
    interface IDataKeysControl
    interface IDataBoundListControl
    interface IDataBoundControl
Public Class ListView
Inherits DataBoundControl
Implements INamingContainer, IPageableItemContainer, IPersistedSelector
Public Class ListView
Inherits DataBoundControl
Implements IDataBoundListControl, IDataKeysControl, INamingContainer, IPageableItemContainer, IPersistedSelector
继承
属性
实现

示例

以下示例演示如何使用 ListView 控件通过 HTML 表显示数据库中的记录。 使用 LinqDataSource 控件检索值。

<%@ 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 元素在流布局中显示值。 使用 SqlDataSource 控件检索值。

<%@ 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 控件插入、删除和更新记录。

重要

此示例具有一个接受用户输入的文本框,这是一个潜在的安全威胁。 默认情况下,ASP.NET 网页验证用户输入是否不包含脚本或 HTML 元素。 有关详细信息,请参阅脚本侵入概述

<%@ 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>

注解

本主题内容:

介绍

控件 ListView 用于显示数据源中的值。 它类似于 GridView 控件,只不过它通过使用用户定义的模板而不是行字段来显示数据。 创建自己的模板可以更灵活地控制数据的显示方式。

本主题随附了一个带有源代码的 Visual Studio 项目: 下载

控件 ListView 支持以下功能:

  • 支持绑定到数据源控件,例如 SqlDataSourceLinqDataSourceObjectDataSource

  • 通过用户定义的模板和样式可自定义的外观。

  • 内置的排序功能。

  • 内置更新和删除功能。

  • 内置插入功能。

  • 支持使用 DataPager 控件的分页功能。

  • 内置项选择功能。

  • ListView 编程方式访问对象模型,以动态设置属性、处理事件等。

  • 多个键字段。

若要了解 ASP.NET 中提供的其他数据绑定控件,请参阅 数据绑定 Web 服务器控件

模板

为了使 ListView 控件显示内容,必须为控件的不同部分创建模板。 ItemTemplate 是必需的。 所有其他模板都是可选的。 属性 LayoutTemplate 不是必需的。

但是,必须为配置控件的模式创建模板。 例如,支持插入记录的 ListView 控件必须定义模板 InsertItemTemplate 。 下表列出了可为 控件创建的 ListView 模板。

模板类型 说明
LayoutTemplate 定义容器对象(如 tabledivspan 元素)的根模板,该对象将包含 或 GroupTemplate 模板中ItemTemplate定义的内容。 它还可能包含 DataPager 对象。
ItemTemplate 定义要为单个项显示的数据绑定内容。
ItemSeparatorTemplate 定义要在各个项之间呈现的内容。
GroupTemplate 定义容器对象,例如表行 (tr) 、 divspan 元素,该对象将包含 和 EmptyItemTemplate 模板中ItemTemplate定义的内容。 组中显示的项数由 GroupItemCount 属性指定。
GroupSeparatorTemplate 定义要在项目组之间呈现的内容。
EmptyItemTemplate 定义在使用模板时 GroupTemplate 要为空项呈现的内容。 例如,如果 GroupItemCount 属性设置为 5,并且从数据源返回的项总数为 8,则控件显示 ListView 的最后一组数据将包含模板指定的 ItemTemplate 三项和模板指定的 EmptyItemTemplate 两项。
EmptyDataTemplate 定义数据源不返回任何数据时要呈现的内容。
SelectedItemTemplate 定义要为所选数据项呈现的内容,以区分所选项与其他项。
AlternatingItemTemplate 定义要为交替项呈现的内容,以便更轻松地区分连续项。
EditItemTemplate 定义在编辑项时要呈现的内容。 模板 EditItemTemplate 将代替 ItemTemplate 正在编辑的数据项的模板呈现。
InsertItemTemplate 定义要呈现以插入项的内容。 模板InsertItemTemplate呈现在控件显示的ListView项的ItemTemplate开头或末尾,代替模板。 可以使用 控件的 InsertItemTemplate 属性ListView指定模板的InsertItemPosition呈现位置。

若要在模板(如 ItemTemplate)中显示字段的值,请使用数据绑定表达式。 有关数据绑定表达式的详细信息,请参阅 数据绑定表达式概述

若要将 和 InsertItemTemplate 模板中的EditItemTemplate输入控件绑定到数据源的字段,可以使用双向绑定表达式。 ListView这使控件能够自动提取用于更新或插入操作的输入控件的值。 双向绑定表达式还允许 中的 EditItemTemplate 输入控件自动显示原始字段值。 有关双向绑定表达式的详细信息,请参阅 绑定到数据库

绑定到数据源

可以将控件绑定到 ListView 数据源控件 ((例如 SqlDataSource 控件或 ObjectDataSource 控件) )或实现 System.Collections.IEnumerable 接口的任何数据源集合,例如 System.Data.DataViewSystem.Collections.ArrayListSystem.Collections.Generic.List<T>或其他集合类型。 使用以下方法之一将 ListView 控件绑定到相应的数据源类型:

  • 若要绑定到数据源控件,请将 控件的 ListView 属性设置为DataSourceIDID数据源控件的值。 控件 ListView 自动绑定到指定的数据源控件,并可以利用数据源控件的功能来执行排序、插入、更新、删除和分页功能。 这是绑定到数据的首选方法。

  • 若要绑定到实现 接口的System.Collections.IEnumerable数据源,请以编程方式将 ListView 控件的 属性设置为DataSource数据源,然后调用 DataBind 方法。 使用此技术时,控件 ListView 不提供内置的排序、更新、删除和分页功能。 必须使用适当的事件来提供此功能。

有关数据绑定的详细信息,请参阅 ASP.NET 数据访问内容映射

注意

控件 ListView 可用于显示用户输入,其中可能包括恶意客户端脚本。 检查从客户端发送的任何信息,以获取可执行脚本、SQL 语句或其他代码,然后再将其显示在应用程序中。 强烈建议在值在此控件中显示之前,尽可能对值进行 HTML 编码。 ASP.NET 提供了输入请求验证功能,可帮助阻止用户输入中的脚本和 HTML。 还可以使用验证服务器控件来检查用户输入。 有关详细信息,请参阅 验证控件简介

数据操作

当控件 ListView 绑定到数据源控件时,该 ListView 控件可以利用数据源控件的功能并提供自动排序、插入、更新和删除功能。

注意

控件 ListView 可以支持对其他类型的数据源进行排序、插入、更新和删除。 但是,若要实现这些操作,必须在适当的事件处理程序中创建代码。

由于 控件 ListView 使用模板,因此它不提供自动生成按钮以执行更新、删除、插入、排序或选择操作的方法。 必须在相应的模板中手动包括这些按钮。 控件 ListView 可识别属性 CommandName 设置为特定值的某些按钮。 下表列出了控件识别的按钮 ListView 及其功能。

Button CommandName 值 说明
取消 “取消” 取消编辑或插入操作。 引发 ItemCanceling 事件。
删除 “Delete” 从数据源中删除当前记录。 引发 ItemDeletedItemDeleting 事件。
选择 “选择” SelectedIndex 属性设置为 DisplayIndex 项的属性值。 呈现 SelectedItemTemplate 项的模板。 引发 SelectedIndexChangingSelectedIndexChanged 事件。
编辑 “编辑” 将项置于编辑模式。 呈现 EditItemTemplate 项的模板。 引发 ItemEditing 事件。
插入 “插入” 将模板中的 InsertItemTemplate 绑定值插入数据源。 引发 ItemInsertingItemInserted 事件。
更新 “Update” 使用模板中的绑定值EditItemTemplate汇报数据源中的当前记录。 引发 ItemUpdatingItemUpdated 事件。
排序 “Sort” 对按钮的 属性中列出的 CommandArgument 列进行排序。 引发 SortingSorted 事件。

与) 立即删除当前数据项的“删除”按钮 (不同,单击“编辑”按钮时, ListView 控件将在编辑模式下显示当前项。 在编辑模式下,为当前数据项显示 属性中包含的 EditItemTemplate 内容。 通常,在编辑项模板中,“编辑”按钮将替换为“更新”和“取消”按钮。 适用于字段数据类型 ((如 TextBoxCheckBox 控件) )的输入控件通常也会显示字段的值以供用户修改。 单击“更新”按钮将更新数据源中的记录,然后单击“取消”按钮将取消编辑操作。

当 属性设置为 FirstItemLastItemInsertItemPosition,将启用插入功能。 此属性定义为插入项呈现模板的位置 InsertItemTemplate 。 插入项模板通常包括“插入”和“取消”按钮,并显示空输入控件,供用户输入新记录的值。 单击“插入”按钮在数据源中插入记录,单击“取消”按钮将清除所有字段。

排序

控件 ListView 使用户能够通过单击“排序”按钮对项进行排序。 排序功能在包含要排序的列的按钮的 属性中 CommandArgument 定义。

分页

控件可以将记录拆分为页, ListView 而不是同时显示数据源中的所有记录。 若要启用分页,请将 DataPager 控件与 控件 ListView 相关联。 然后在模板中LayoutTemplate插入控件DataPager。 或者,如果 DataPager 控件位于 控件外部 ListView ,请将 PagedControlID 属性设置为 ID 控件的 ListView

事件

下表列出了 控件支持 ListView 的事件。

事件 说明
ItemCanceling 当“取消”按钮 (按钮属性 CommandName 设置为“取消”时发生,) 单击控件取消插入或编辑操作之前 ListView 。 此事件通常用于停止取消操作。
ItemCommand ListView 控件中单击某个按钮时发生。 此事件通常用于在控件中单击按钮时执行自定义任务。
ItemCreated 在 控件中 ListView 创建新项时发生。 此事件通常用于在创建项时修改项的内容。
ItemDataBound 当数据项绑定到控件中的数据时发生 ListView 。 当项绑定到数据时,此事件通常用于修改项的内容。
ItemDeleted 当“删除”按钮 (按钮属性CommandName设置为“Delete”时发生,) 控件从数据源中删除记录后ListView单击或DeleteItem调用 方法。 此事件通常用于检查删除操作的结果。
ItemDeleting 当“删除”按钮 (按钮属性 CommandName 设置为“Delete”时发生,) 单击或 DeleteItem 调用 方法,但在控件从数据源中删除记录之前 ListView 。 此事件通常用于确认或取消删除操作。
ItemEditing 当“编辑”按钮 (其属性设置为“编辑”的按钮 CommandName 时发生,) 单击控件进入编辑模式之前 ListView 。 此事件通常用于取消编辑操作。
ItemInserted 当“插入”按钮 (按钮属性CommandName设置为“Insert”时发生,) 控件从数据源插入新记录后ListView单击或InsertNewItem调用 方法。 此事件通常用于检查插入操作的结果。
ItemInserting 当“插入”按钮 (其属性设置为“Insert”的按钮 CommandName 时发生) 单击或 InsertNewItem 调用 方法,但在控件插入记录之前 ListView 。 此事件通常用于取消插入操作或更改或验证新项的值。
ItemUpdated 当“更新”按钮 (按钮属性 CommandName 设置为“更新”时发生,) 单击控件 UpdateItem 更新记录后 ListView 或调用 方法。 此事件通常用于检查更新操作的结果。
ItemUpdating 当更新按钮 (按钮属性 CommandName 设置为“Update”时发生,) 单击或 UpdateItem 调用 方法,但在控件更新记录之前 ListView 。 此事件通常用于取消更新操作,或更改或验证已编辑项的值。
LayoutCreated LayoutTemplate 控件中创建 ListView 模板后发生。 此事件通常用于在创建模板后执行任务。
PagePropertiesChanged 在页属性更改且 ListView 控件设置新值之后发生。
PagePropertiesChanging 在数据页属性更改时,但在控件设置新值之前 ListView 发生。
SelectedIndexChanged 当“选择”按钮 (其属性设置为“Select”的按钮 CommandName 时发生,) 控件处理选择操作后 ListView 单击。 此事件通常用于在控件中选择项后执行自定义任务。
SelectedIndexChanging 当“选择”按钮 (属性设置为“Select”的按钮 CommandName 时发生) 单击,但在控件处理选择操作之前 ListView 。 此事件通常用于取消选择操作。
Sorted 当“排序”按钮 (其属性设置为“Sort”的按钮CommandName时发生,) 控件处理排序操作后ListView单击或Sort调用 方法。 此事件通常用于在用户单击“排序”按钮并已对数据进行排序后执行自定义任务。
Sorting 当排序按钮 (其 CommandName 属性设置为“Sort”的按钮时发生,) 单击或 Sort 调用 方法,但在控件处理排序操作之前 ListView 。 此事件通常用于取消排序操作或执行自定义排序例程。

声明性语法

<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 类的新实例。

属性

AccessKey

重写 AccessKey 属性。 ListView 控件不支持设置此属性。

Adapter

获取控件的浏览器特定适配器。

(继承自 Control)
AlternatingItemTemplate

获取或设置 ListView 控件中交替数据项的自定义内容。

AppRelativeTemplateSourceDirectory

获取或设置包含该控件的 PageUserControl 对象的应用程序相对虚拟目录。

(继承自 Control)
Attributes

获取与控件的特性不对应的任意特性(只用于呈现)的集合。

(继承自 WebControl)
BackColor

重写 BackColor 属性。 ListView 控件不支持设置此属性。

BindingContainer

获取包含该控件的数据绑定的控件。

(继承自 Control)
BorderColor

重写 BorderColor 属性。 ListView 控件不支持设置此属性。

BorderStyle

重写 BorderStyle 属性。 ListView 控件不支持设置此属性。

BorderWidth

重写 BorderWidth 属性。 ListView 控件不支持设置此属性。

ChildControlsCreated

获取一个值,该值指示是否已创建服务器控件的子控件。

(继承自 Control)
ClientID

获取由 ASP.NET 生成的 HTML 标记的控件 ID。

(继承自 Control)
ClientIDMode

获取或设置用于生成 ClientID 属性值的算法。

(继承自 Control)
ClientIDRowSuffix

获取或设置数据字段的名称,当 ListView 属性设置为 ClientIDMode 时,这些数据字段的值用于唯一地标识 Predictable 控件的每个数据行。

ClientIDRowSuffixDataKeys

获取数据值,在 ASP.NET 生成 ClientID 值时,这些数据值用于唯一标识数据绑定控件的每个实例。

ClientIDSeparator

获取一个字符值,该值表示 ClientID 属性中使用的分隔符字符。

(继承自 Control)
Context

为当前 Web 请求获取与服务器控件关联的 HttpContext 对象。

(继承自 Control)
Controls

获取一个 ControlCollection 对象,该对象表示 ListView 控件的子控件。

ControlStyle

获取 Web 服务器控件的样式。 此属性主要由控件开发人员使用。

(继承自 WebControl)
ControlStyleCreated

获取一个值,该值指示是否已为 Style 属性创建了 ControlStyle 对象。 此属性主要由控件开发人员使用。

(继承自 WebControl)
ConvertEmptyStringToNull

获取或设置一个值,该值指示在数据源中更新数据字段时是否将空字符串值 ("") 自动转换为 null 值。

CssClass

重写 CssClass 属性。 ListView 控件不支持设置此属性。

DataItemContainer

如果命名容器实现 IDataItemContainer,则获取对命名容器的引用。

(继承自 Control)
DataKeyNames

获取或设置一个数组,该数组包含了显示在 ListView 控件中的项的主键字段的名称。

DataKeys

获取一个 DataKey 对象集合,这些对象表示 ListView 控件中的每一项的数据键值。

DataKeysContainer

如果命名容器实现 IDataKeysControl,则获取对命名容器的引用。

(继承自 Control)
DataMember

当数据源包含多个不同的数据项列表时,获取或设置数据绑定控件绑定到的数据列表的名称。

(继承自 DataBoundControl)
DataSource

获取或设置对象,数据绑定控件从该对象中检索其数据项列表。

(继承自 BaseDataBoundControl)
DataSourceID

获取或设置控件的 ID,数据绑定控件从该控件中检索其数据项列表。

(继承自 DataBoundControl)
DataSourceObject

获取一个对象,该对象实现 IDataSource 接口,以便提供对该对象的数据内容的访问。

(继承自 DataBoundControl)
DeleteMethod

获取或设置为了删除数据要调用的方法的名称。

DesignMode

获取一个值,该值指示是否正在使用设计图面上的一个控件。

(继承自 Control)
EditIndex

获取或设置所编辑的项的索引。

EditItem

获取 ListView 控件中处于编辑模式的项。

EditItemTemplate

获取或设置处于编辑模式的项的自定义内容。

EmptyDataTemplate

获取或设置在 ListView 控件绑定到不包含任何记录的数据源时所呈现的空模板的用户定义内容。

EmptyItemTemplate

获取或设置在当前数据页的最后一行中没有可显示的数据项时,ListView 控件中呈现的空项的用户定义内容。

Enabled

获取或设置一个值,该值指示是否启用 Web 服务器控件。

(继承自 WebControl)
EnableModelValidation

获取或设置一个值,该值指示验证程序控件是否会处理在插入或更新操作过程中出现的异常。

EnablePersistedSelection

获取或设置一个值,该值指示当用户在逐页浏览数据绑定控件中的数据时,行选择是否保持。

EnableTheming

获取或设置一个值,该值指示主题是否应用于该控件。

(继承自 WebControl)
EnableViewState

获取或设置一个值,该值指示服务器控件是否向发出请求的客户端保持自己的视图状态以及它所包含的任何子控件的视图状态。

(继承自 Control)
Events

获取控件的事件处理程序委托列表。 此属性为只读。

(继承自 Control)
Font

重写 Font 属性。 ListView 控件不支持此属性。

ForeColor

重写 ForeColor 属性。 ListView 控件不支持设置此属性。

GroupItemCount

获取或设置 ListView 控件中每组显示的项数。

GroupPlaceholderID

获取或设置 ListView 控件中的组占位符的 ID。

GroupSeparatorTemplate

获取或设置 ListView 控件中的组之间的分隔符的用户定义内容。

GroupTemplate

获取或设置 ListView 控件中的组容器的用户定义内容。

HasAttributes

获取一个值,该值指示控件是否具有特性集。

(继承自 WebControl)
HasChildViewState

获取一个值,该值指示当前服务器控件的子控件是否具有任何已保存的视图状态设置。

(继承自 Control)
Height

重写 Height 属性。 ListView 控件不支持设置此属性。

ID

获取或设置分配给服务器控件的编程标识符。

(继承自 Control)
IdSeparator

获取用于分隔控件标识符的字符。

(继承自 Control)
Initialized

获取一个值,该值指示数据绑定控件是否已经初始化。

(继承自 BaseDataBoundControl)
InsertItem

获取 ListView 控件的插入项。

InsertItemPosition

获取或设置 InsertItemTemplate 模板在作为 ListView 控件的一部分呈现时的位置。

InsertItemTemplate

获取或设置 ListView 控件中的插入项的自定义内容。

InsertMethod

获取或设置为了插入数据要调用的方法的名称。

IsBoundUsingDataSourceID

获取指示是否设置 DataSourceID 属性的值。

(继承自 BaseDataBoundControl)
IsChildControlStateCleared

获取一个值,该值指示该控件中包含的控件是否具有控件状态。

(继承自 Control)
IsDataBindingAutomatic

获取一个值,该值指示数据绑定是否自动进行。

(继承自 BaseDataBoundControl)
IsEnabled

获取一个值,该值指示是否启用控件。

(继承自 WebControl)
IsTrackingViewState

获取一个值,用于指示服务器控件是否会将更改保存到其视图状态中。

(继承自 Control)
IsUsingModelBinders

获取一个值,该值指示是否使用模型绑定。

IsUsingModelBinders

获取一个值,该值指示是否使用模型绑定。

(继承自 DataBoundControl)
IsViewStateEnabled

获取一个值,该值指示是否为该控件启用了视图状态。

(继承自 Control)
ItemPlaceholderID

获取或设置 ListView 控件中的项占位符的 ID。

Items

获取一个 ListViewDataItem 对象集合,这些对象表示 ListView 控件中的当前数据页的数据项。

ItemSeparatorTemplate

获取或设置 ListView 控件中的项之间的分隔符的自定义内容。

ItemTemplate

获取或设置 ListView 控件中的数据项的自定义内容。

ItemType

获取或设置强类型化数据绑定的数据项目类型的名称。

(继承自 DataBoundControl)
LayoutTemplate

获取或设置 ListView 控件中的根容器的自定义内容。

LoadViewStateByID

获取一个值,该值指示控件是否通过 ID 而不是索引参与加载其视图状态。

(继承自 Control)
MaximumRows

获取要在 ListView 控件的单个页上显示的最大项数。

NamingContainer

获取对服务器控件的命名容器的引用,此引用创建唯一的命名空间,以区分具有相同 ID 属性值的服务器控件。

(继承自 Control)
Page

获取对包含服务器控件的 Page 实例的引用。

(继承自 Control)
Parent

获取对页 UI 层次结构中服务器控件的父控件的引用。

(继承自 Control)
RenderingCompatibility

获取一个值,该值指定呈现的 HTML 将与之兼容的 ASP.NET 版本。

(继承自 Control)
RequiresDataBinding

获取或设置一个值,该值指示是否应调用 DataBind() 方法。

(继承自 BaseDataBoundControl)
SelectArguments

获取数据绑定控件从数据源控件检索数据时使用的 DataSourceSelectArguments 对象。

(继承自 DataBoundControl)
SelectedDataKey

获取 ListView 控件中的选定项的数据键值。

SelectedIndex

获取或设置 ListView 控件中的选定项的索引。

SelectedItemTemplate

获取或设置 ListView 控件中的选定项的自定义内容。

SelectedPersistedDataKey

获取或设置数据绑定控件中选择的持久项的数据键值。

SelectedValue

获取 ListView 控件中的选定项的数据键值。

SelectMethod

为了读取数据要调用的方法的名称。

(继承自 DataBoundControl)
Site

获取容器信息,该容器在呈现于设计图面上时承载当前控件。

(继承自 Control)
SkinID

获取或设置要应用于控件的外观。

(继承自 WebControl)
SortDirection

获取要排序的字段的排序方向。

SortExpression

获取与要排序的字段关联的排序表达式。

StartRowIndex

获取 ListView 控件中的数据页上显示的第一条记录的索引。

Style

获取将在 Web 服务器控件的外部标记上呈现为样式特性的文本特性的集合。

(继承自 WebControl)
SupportsDisabledAttribute

获取一个值,该值指示在控件的 disabled 属性为 IsEnabled 时,控件是否应将呈现的 HTML 元素的 false 特性设置为 "disabled"。

(继承自 BaseDataBoundControl)
TabIndex

重写 TabIndex 属性。 ListView 控件不支持设置此属性。

TagKey

获取对应于此 Web 服务器控件的 HtmlTextWriterTag 值。 此属性主要由控件开发人员使用。

(继承自 WebControl)
TagName

获取控件标记的名称。 此属性主要由控件开发人员使用。

(继承自 WebControl)
TemplateControl

获取或设置对包含该控件的模板的引用。

(继承自 Control)
TemplateSourceDirectory

获取包含当前服务器控件的 PageUserControl 的虚拟目录。

(继承自 Control)
ToolTip

重写 ToolTip 属性。 ListView 控件不支持设置此属性。

UniqueID

获取服务器控件的唯一的、以分层形式限定的标识符。

(继承自 Control)
UpdateMethod

获取或设置为了更新数据要调用的方法的名称。

ValidateRequestMode

获取或设置指示控件是否检查来自浏览器的客户端输入是否具有潜在危险值的值。

(继承自 Control)
ViewState

获取状态信息的字典,这些信息使您可以在同一页的多个请求间保存和还原服务器控件的视图状态。

(继承自 Control)
ViewStateIgnoresCase

获取一个值,该值指示 StateBag 对象是否不区分大小写。

(继承自 Control)
ViewStateMode

获取或设置此控件的视图状态模式。

(继承自 Control)
Visible

获取或设置一个值,该值指示服务器控件是否作为 UI 呈现在页上。

(继承自 Control)
Width

重写 Width 属性。 ListView 控件不支持设置此属性。

方法

AddAttributesToRender(HtmlTextWriter)

将需要呈现的 HTML 特性和样式添加到指定的 HtmlTextWriterTag 中。 此方法主要由控件开发人员使用。

(继承自 WebControl)
AddControlToContainer(Control, Control, Int32)

将指定控件添加到指定容器。

AddedControl(Control, Int32)

在子控件添加到 Control 对象的 Controls 集合后调用。

(继承自 Control)
AddParsedSubObject(Object)

通知服务器控件,分析了一个元素(XML 或 HTML),并将该元素添加到服务器控件的 ControlCollection 对象中。

(继承自 Control)
ApplyStyle(Style)

将指定样式的所有非空白元素复制到 Web 控件,覆盖控件的所有现有的样式元素。 此方法主要由控件开发人员使用。

(继承自 WebControl)
ApplyStyleSheetSkin(Page)

将页样式表中定义的样式属性应用到控件。

(继承自 Control)
BeginRenderTracing(TextWriter, Object)

开始输出数据的设计时追踪。

(继承自 Control)
BuildProfileTree(String, Boolean)

收集有关服务器控件的信息并将该信息发送到 Trace 属性,在启用页的跟踪功能时将显示该属性。

(继承自 Control)
ClearCachedClientID()

将缓存的 ClientID 值设置为 null

(继承自 Control)
ClearChildControlState()

删除服务器控件的子控件的控件状态信息。

(继承自 Control)
ClearChildState()

删除服务器控件的所有子控件的视图状态和控件状态信息。

(继承自 Control)
ClearChildViewState()

删除服务器控件的所有子控件的视图状态信息。

(继承自 Control)
ClearEffectiveClientIDMode()

将当前控件实例和任何子控件的 ClientIDMode 属性设置为 Inherit

(继承自 Control)
ConfirmInitState()

设置数据绑定控件的初始化状态。

(继承自 BaseDataBoundControl)
CopyBaseAttributes(WebControl)

Style 对象未封装的属性从指定的 Web 服务器控件复制到从中调用此方法的 Web 服务器控件。 此方法主要由控件开发人员使用。

(继承自 WebControl)
CreateChildControls()

根据视图状态中存储的值,创建用于呈现 ListView 控件的控件层次结构。

CreateChildControls(IEnumerable, Boolean)

使用指定数据源创建用于呈现 ListView 控件的控件层次结构。

CreateControlCollection()

创建一个新 ControlCollection 对象来保存服务器控件的子控件(包括文本控件和服务器控件)。

(继承自 Control)
CreateControlStyle()

为控件创建默认样式。

CreateDataItem(Int32, Int32)

ListView 控件中创建一个数据项。

CreateDataSourceSelectArguments()

创建 DataSourceSelectArguments 对象,该对象包含传递到数据源的参数。

CreateEmptyDataItem()

EmptyDataTemplate 控件中创建 ListView 模板。

CreateEmptyItem()

ListView 控件中创建一个空项。

CreateInsertItem()

ListView 控件中创建一个插入项。

CreateItem(ListViewItemType)

创建一个具有指定类型的 ListViewItem 对象。

CreateItemsInGroups(ListViewPagedDataSource, Boolean, InsertItemPosition, ArrayList)

以组的形式创建 ListView 控件层次结构。

CreateItemsWithoutGroups(ListViewPagedDataSource, Boolean, InsertItemPosition, ArrayList)

创建不带有组的 ListView 控件层次结构。

CreateLayoutTemplate()

ListView 控件中创建根容器。

CreateSuffixArrayList(ListViewPagedDataSource, ArrayList)

创建一个后缀数组,以供 ASP.NET 在其生成 ClientID 值时使用。

DataBind()

将数据源绑定到调用的服务器控件及其所有子控件。

(继承自 BaseDataBoundControl)
DataBind(Boolean)

将数据源绑定到调用的服务器控件及其所有子控件,同时可以选择引发 DataBinding 事件。

(继承自 Control)
DataBindChildren()

将数据源绑定到服务器控件的子控件。

(继承自 Control)
DeleteItem(Int32)

从数据源中删除位于指定索引位置的记录。

Dispose()

使服务器控件得以在从内存中释放之前执行最后的清理操作。

(继承自 Control)
EndRenderTracing(TextWriter, Object)

结束输出数据的设计时追踪。

(继承自 Control)
EnsureChildControls()

确定服务器控件是否包含子控件。 如果不包含,则创建子控件。

(继承自 Control)
EnsureDataBound()

如果设置了 DataBind() 属性且数据绑定控件标记为需要绑定,则调用 DataSourceID 方法。

(继承自 BaseDataBoundControl)
EnsureID()

为尚未分配标识符的控件创建标识符。

(继承自 Control)
EnsureLayoutTemplate()

确保在 LayoutTemplate 控件中正确创建 ListView 内容。

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
ExtractItemValues(IOrderedDictionary, ListViewItem, Boolean)

检索在指定项中声明的每个字段的值,并将它们存储在指定的 IOrderedDictionary 对象中。

FindControl(String)

在当前的命名容器中搜索带指定 id 参数的服务器控件。

(继承自 Control)
FindControl(String, Int32)

使用指定的 idpathOffset 参数(该参数有助于搜索)中指定的整数在当前命名容器中搜索服务器控件。 不应重写此版本的 FindControl 方法。

(继承自 Control)
FindPlaceholder(String, Control)

在指定容器中搜索具有指定标识符的控件。

Focus()

为控件设置输入焦点。

(继承自 Control)
GetData()

检索数据绑定控件用于执行数据操作的 DataSourceView 对象。

(继承自 DataBoundControl)
GetDataSource()

检索与数据绑定控件关联的 IDataSource 接口(如果有)。

(继承自 DataBoundControl)
GetDesignModeState()

获取控件的设计时数据。

(继承自 Control)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetRouteUrl(Object)

获取与一组路由参数对应的 URL。

(继承自 Control)
GetRouteUrl(RouteValueDictionary)

获取与一组路由参数对应的 URL。

(继承自 Control)
GetRouteUrl(String, Object)

获取与一组路由参数以及某个路由名称对应的 URL。

(继承自 Control)
GetRouteUrl(String, RouteValueDictionary)

获取与一组路由参数以及某个路由名称对应的 URL。

(继承自 Control)
GetType()

获取当前实例的 Type

(继承自 Object)
GetUniqueIDRelativeTo(Control)

返回指定控件的 UniqueID 属性的前缀部分。

(继承自 Control)
HasControls()

确定服务器控件是否包含任何子控件。

(继承自 Control)
HasEvents()

返回一个值,该值指示是否为控件或任何子控件注册事件。

(继承自 Control)
InsertNewItem(Boolean)

将当前记录插入到数据源中。

InstantiateEmptyDataTemplate(Control)

通过使用 Control 模板中包含的子控件,填充指定的 EmptyDataTemplate 对象。

InstantiateEmptyItemTemplate(Control)

通过使用 Control 模板中包含的子控件,填充指定的 EmptyItemTemplate 对象。

InstantiateGroupSeparatorTemplate(Control)

通过使用 Control 模板中包含的子控件,填充指定的 GroupSeparatorTemplate 对象。

InstantiateGroupTemplate(Control)

通过使用 Control 模板中包含的子控件,填充指定的 GroupTemplate 对象。

InstantiateInsertItemTemplate(Control)

通过使用 Control 模板中包含的子控件,填充指定的 InsertItemTemplate 对象。

InstantiateItemSeparatorTemplate(Control)

通过使用 Control 模板中包含的子控件,填充指定的 ItemSeparatorTemplate 对象。

InstantiateItemTemplate(Control, Int32)

通过使用其中一个 Control 控件模板的子控件,填充指定的 ListView 对象。

IsLiteralContent()

确定服务器控件是否只包含文字内容。

(继承自 Control)
LoadControlState(Object)

加载 ListView 控件中必须保持的属性的状态(即使在 EnableViewState 属性设置为 false 时仍然加载)。

LoadViewState(Object)

加载以前保存的 ListView 控件的视图状态。

MapPathSecure(String)

检索虚拟路径(绝对的或相对的)映射到的物理路径。

(继承自 Control)
MarkAsDataBound()

将视图状态中的控件状态设置为成功绑定到数据。

(继承自 DataBoundControl)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
MergeStyle(Style)

将指定样式的所有非空白元素复制到 Web 控件,但不覆盖该控件现有的任何样式元素。 此方法主要由控件开发人员使用。

(继承自 WebControl)
OnBubbleEvent(Object, EventArgs)

确定是否应处理 ListView 控件的事件。

OnCreatingModelDataSource(CreatingModelDataSourceEventArgs)

引发 CreatingModelDataSource 事件。

(继承自 DataBoundControl)
OnDataBinding(EventArgs)

引发 DataBinding 事件。

(继承自 Control)
OnDataBound(EventArgs)

引发 DataBound 事件。

(继承自 BaseDataBoundControl)
OnDataPropertyChanged()

在某一基数据源标识属性更改后,将数据绑定控件重新绑定到其数据。

(继承自 DataBoundControl)
OnDataSourceViewChanged(Object, EventArgs)

引发 DataSourceViewChanged 事件。

(继承自 DataBoundControl)
OnInit(EventArgs)

引发 Init 事件。

OnItemCanceling(ListViewCancelEventArgs)

引发 ItemCanceling 事件。

OnItemCommand(ListViewCommandEventArgs)

引发 ItemCommand 事件。

OnItemCreated(ListViewItemEventArgs)

引发 ItemCreated 事件。

OnItemDataBound(ListViewItemEventArgs)

引发 ItemDataBound 事件。

OnItemDeleted(ListViewDeletedEventArgs)

引发 ItemDeleted 事件。

OnItemDeleting(ListViewDeleteEventArgs)

引发 ItemDeleting 事件。

OnItemEditing(ListViewEditEventArgs)

引发 ItemEditing 事件。

OnItemInserted(ListViewInsertedEventArgs)

引发 ItemInserted 事件。

OnItemInserting(ListViewInsertEventArgs)

引发 ItemInserting 事件。

OnItemUpdated(ListViewUpdatedEventArgs)

引发 ItemUpdated 事件。

OnItemUpdating(ListViewUpdateEventArgs)

引发 ItemUpdating 事件。

OnLayoutCreated(EventArgs)

引发 LayoutCreated 事件。

OnLoad(EventArgs)

处理 Load 事件。

(继承自 DataBoundControl)
OnPagePreLoad(Object, EventArgs)

在加载数据绑定控件之前设置该控件的初始化状态。

(继承自 DataBoundControl)
OnPagePropertiesChanged(EventArgs)

引发 PagePropertiesChanged 事件。

OnPagePropertiesChanging(PagePropertiesChangingEventArgs)

引发 PagePropertiesChanging 事件。

OnPreRender(EventArgs)

处理 PreRender 事件。

(继承自 BaseDataBoundControl)
OnSelectedIndexChanged(EventArgs)

引发 SelectedIndexChanged 事件。

OnSelectedIndexChanging(ListViewSelectEventArgs)

引发 SelectedIndexChanging 事件。

OnSorted(EventArgs)

引发 Sorted 事件。

OnSorting(ListViewSortEventArgs)

引发 Sorting 事件。

OnTotalRowCountAvailable(PageEventArgs)

引发 IPageableItemContainer.TotalRowCountAvailable 事件。

OnUnload(EventArgs)

引发 Unload 事件。

(继承自 Control)
OpenFile(String)

获取用于读取文件的 Stream

(继承自 Control)
PerformDataBinding(IEnumerable)

ListView 控件绑定到指定的数据源。

PerformSelect()

从关联的数据源中检索数据。

RaiseBubbleEvent(Object, EventArgs)

将所有事件源及其信息分配给控件的父级。

(继承自 Control)
RemovedControl(Control)

Control 对象的 Controls 集合移除子控件后调用。

(继承自 Control)
RemoveItems()

删除 ListView 控件的项或组容器中的所有子控件。

Render(HtmlTextWriter)

使用指定的 HtmlTextWriter 对象将 Web 服务器控件内容呈现到客户端的浏览器。

RenderBeginTag(HtmlTextWriter)

将控件的 HTML 开始标记呈现到指定的编写器中。 此方法主要由控件开发人员使用。

(继承自 WebControl)
RenderChildren(HtmlTextWriter)

将服务器控件子级的内容输出到提供的 HtmlTextWriter 对象,该对象可写入要在客户端上呈现的内容。

(继承自 Control)
RenderContents(HtmlTextWriter)

将控件的内容呈现到指定的编写器中。 此方法主要由控件开发人员使用。

(继承自 WebControl)
RenderControl(HtmlTextWriter)

将服务器控件内容输出到所提供的 HtmlTextWriter 对象,如果启用了跟踪,则还将存储有关该控件的跟踪信息。

(继承自 Control)
RenderControl(HtmlTextWriter, ControlAdapter)

使用提供的 HtmlTextWriter 对象将服务器控件内容输出到提供的 ControlAdapter 对象。

(继承自 Control)
RenderEndTag(HtmlTextWriter)

将控件的 HTML 结束标记呈现到指定的编写器中。 此方法主要由控件开发人员使用。

(继承自 WebControl)
ResolveAdapter()

获取负责呈现指定控件的控件适配器。

(继承自 Control)
ResolveClientUrl(String)

获取浏览器可以使用的 URL。

(继承自 Control)
ResolveUrl(String)

将 URL 转换为在请求客户端可用的 URL。

(继承自 Control)
SaveControlState()

保存 ListView 控件中必须保持的属性的状态(即使在 EnableViewState 属性设置为 false 时仍然保存)。

SaveViewState()

保存 ListView 控件的当前视图状态。

SelectItem(Int32)

选择 ListView 控件中处于编辑模式的项。

SetDesignModeState(IDictionary)

为控件设置设计时数据。

(继承自 Control)
SetEditItem(Int32)

ListView 控件中将指定项设置为编辑模式。

SetPageProperties(Int32, Int32, Boolean)

设置 ListView 控件中的数据页的属性。

SetRenderMethodDelegate(RenderMethod)

分配事件处理程序委托,以将服务器控件及其内容呈现到父控件中。

(继承自 Control)
SetTraceData(Object, Object)

使用跟踪数据键和跟踪数据值,为呈现数据的设计时追踪设置跟踪数据。

(继承自 Control)
SetTraceData(Object, Object, Object)

使用跟踪对象、跟踪数据键和跟踪数据值,为呈现数据的设计时追踪设置跟踪数据。

(继承自 Control)
Sort(String, SortDirection)

根据指定的排序表达式和方向对 ListView 控件进行排序。

ToString()

返回表示当前对象的字符串。

(继承自 Object)
TrackViewState()

导致要跟踪的控件的视图状态的更改,以便这些更改可以存储到控件的 StateBag 对象中。

(继承自 DataBoundControl)
UpdateItem(Int32, Boolean)

更新数据源中指定索引处的记录。

ValidateDataSource(Object)

验证数据绑定控件绑定到的对象是否可以和该控件一同使用。

(继承自 DataBoundControl)

事件

CallingDataMethods

在数据方法正被调用时发生。

(继承自 DataBoundControl)
CreatingModelDataSource

ModelDataSource 对象正被创建时发生。

(继承自 DataBoundControl)
DataBinding

当服务器控件绑定到数据源时发生。

(继承自 Control)
DataBound

在服务器控件绑定到数据源后发生。

(继承自 BaseDataBoundControl)
Disposed

当从内存释放服务器控件时发生,这是请求 ASP.NET 页时服务器控件生存期的最后阶段。

(继承自 Control)
Init

当服务器控件初始化时发生;初始化是控件生存期的第一步。

(继承自 Control)
ItemCanceling

在请求取消操作之后、ListView 控件取消插入或编辑操作之前发生。

ItemCommand

当单击 ListView 控件中的按钮时发生。

ItemCreated

ListView 控件中创建项时发生。

ItemDataBound

在数据项绑定到 ListView 控件中的数据时发生。

ItemDeleted

在请求删除操作且 ListView 控件删除项之后发生。

ItemDeleting

在请求删除操作之后、ListView 控件删除项之前发生。

ItemEditing

在请求编辑操作之后、ListView 项进入编辑模式之前发生。

ItemInserted

在请求插入操作且 ListView 控件在数据源中插入项之后发生。

ItemInserting

在请求插入操作之后、ListView 控件执行插入之前发生。

ItemUpdated

在请求更新操作且 ListView 控件更新项之后发生。

ItemUpdating

在请求更新操作之后、ListView 控件更新项之前发生。

LayoutCreated

LayoutTemplate 控件中创建 ListView 模板后发生。

Load

当服务器控件加载到 Page 对象中时发生。

(继承自 Control)
PagePropertiesChanged

在页属性更改且 ListView 控件设置新值之后发生。

PagePropertiesChanging

在页属性更改之后、ListView 控件设置新值之前发生。

PreRender

在加载 Control 对象之后、呈现之前发生。

(继承自 Control)
SelectedIndexChanged

在单击项的“选择”按钮且 ListView 控件处理选择操作之后发生。

SelectedIndexChanging

在单击项的“选择”按钮之后、ListView 控件处理选择操作之前发生。

Sorted

在请求排序操作且 ListView 控件处理排序操作之后发生。

Sorting

在请求排序操作之后、ListView 控件处理排序操作之前发生。

Unload

当服务器控件从内存中卸载时发生。

(继承自 Control)

显式接口实现

IAttributeAccessor.GetAttribute(String)

获取具有指定名称的 Web 控件的特性。

(继承自 WebControl)
IAttributeAccessor.SetAttribute(String, String)

将 Web 控件的特性设置为指定的名称和值。

(继承自 WebControl)
IControlBuilderAccessor.ControlBuilder

有关此成员的说明,请参见 ControlBuilder

(继承自 Control)
IControlDesignerAccessor.GetDesignModeState()

有关此成员的说明,请参见 GetDesignModeState()

(继承自 Control)
IControlDesignerAccessor.SetDesignModeState(IDictionary)

有关此成员的说明,请参见 SetDesignModeState(IDictionary)

(继承自 Control)
IControlDesignerAccessor.SetOwnerControl(Control)

有关此成员的说明,请参见 SetOwnerControl(Control)

(继承自 Control)
IControlDesignerAccessor.UserData

有关此成员的说明,请参见 UserData

(继承自 Control)
IDataBindingsAccessor.DataBindings

有关此成员的说明,请参见 DataBindings

(继承自 Control)
IDataBindingsAccessor.HasDataBindings

有关此成员的说明,请参见 HasDataBindings

(继承自 Control)
IDataBoundControl.DataKeyNames

获取或设置一个数组,该数组包含显示在数据绑定控件中的项的主键字段的名称。

IDataBoundControl.DataMember

当数据源包含多个不同的数据项列表时,获取或设置数据绑定控件绑定到的数据列表的名称。

IDataBoundControl.DataSource

获取或设置对象,数据绑定控件从该对象中检索其数据项列表。

IDataBoundControl.DataSourceID

获取或设置数据源控件的 ID,数据绑定控件从数据源控件中检索其数据项列表。

IDataBoundControl.DataSourceObject

获取一个对象,该对象实现 IDataSource 接口,以便提供对该对象的数据内容的访问。

IDataBoundListControl.ClientIDRowSuffix

获取数据字段的名称,当 ListView 属性设置为 ClientIDMode 时,这些数据字段的值用于唯一地标识 Predictable 控件的每个数据行。

IDataBoundListControl.DataKeys

获取数据键值的集合,这些值表示数据绑定控件中的每一行。

IDataBoundListControl.EnablePersistedSelection

获取或设置一个值,该值指定当用户在逐页浏览数据绑定控件的数据时,所选行是否保持。

IDataBoundListControl.SelectedDataKey

获取数据键对象,其中包含数据绑定控件中所选行的数据键值。

IDataBoundListControl.SelectedIndex

获取或设置数据绑定控件中所选行的索引。

IDataKeysControl.ClientIDRowSuffixDataKeys

获取数据值的集合,在 ASP.NET 生成 ClientID 值时,这些数据值用于唯一标识数据绑定控件的每个实例。

IExpressionsAccessor.Expressions

有关此成员的说明,请参见 Expressions

(继承自 Control)
IExpressionsAccessor.HasExpressions

有关此成员的说明,请参见 HasExpressions

(继承自 Control)
IPageableItemContainer.MaximumRows

有关此成员的说明,请参见 MaximumRows

IPageableItemContainer.SetPageProperties(Int32, Int32, Boolean)

有关此成员的说明,请参见 SetPageProperties(Int32, Int32, Boolean)

IPageableItemContainer.StartRowIndex

有关此成员的说明,请参见 StartRowIndex

IPageableItemContainer.TotalRowCountAvailable

有关此成员的说明,请参见 TotalRowCountAvailable

IParserAccessor.AddParsedSubObject(Object)

有关此成员的说明,请参见 AddParsedSubObject(Object)

(继承自 Control)
IPersistedSelector.DataKey

获取或设置数据绑定控件中所选记录的数据键值。

扩展方法

EnablePersistedSelection(BaseDataBoundControl)
已过时.

使选定内容能够保留在支持选择和分页的数据控件中。

FindDataSourceControl(Control)

返回与指定控件的数据控件关联的数据源。

FindFieldTemplate(Control, String)

返回指定控件的命名容器中指定列的字段模板。

FindMetaTable(Control)

返回包含数据控件的元表对象。

GetDefaultValues(INamingContainer)

为指定数据控件获取默认值的集合。

GetMetaTable(INamingContainer)

为指定数据控件获取表元数据。

SetMetaTable(INamingContainer, MetaTable)

为指定数据控件设置表元数据。

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

为指定数据控件设置表元数据和默认值映射。

SetMetaTable(INamingContainer, MetaTable, Object)

为指定数据控件设置表元数据和默认值映射。

TryGetMetaTable(INamingContainer, MetaTable)

确定表元数据是否可用。

EnableDynamicData(INamingContainer, Type)

为指定数据控件启用动态数据行为。

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

为指定数据控件启用动态数据行为。

EnableDynamicData(INamingContainer, Type, Object)

为指定数据控件启用动态数据行为。

适用于

另请参阅