DetailsView DetailsView DetailsView DetailsView Class

定義

從資料表的資料來源顯示單一資料錄的值,其中每個資料列都代表資料錄的欄位。Displays the values of a single record from a data source in a table, where each data row represents a field of the record. DetailsView 控制項可讓您編輯、刪除及插入記錄。The DetailsView control allows you to edit, delete, and insert records.

public ref class DetailsView : System::Web::UI::WebControls::CompositeDataBoundControl, System::Web::UI::ICallbackEventHandler, System::Web::UI::IDataItemContainer, System::Web::UI::IPostBackEventHandler, System::Web::UI::WebControls::ICallbackContainer, System::Web::UI::WebControls::IDataBoundItemControl, System::Web::UI::WebControls::IFieldControl, System::Web::UI::WebControls::IPostBackContainer
[System.Web.UI.ControlValueProperty("SelectedValue")]
public class DetailsView : System.Web.UI.WebControls.CompositeDataBoundControl, System.Web.UI.ICallbackEventHandler, System.Web.UI.IDataItemContainer, System.Web.UI.IPostBackEventHandler, System.Web.UI.WebControls.ICallbackContainer, System.Web.UI.WebControls.IDataBoundItemControl, System.Web.UI.WebControls.IFieldControl, System.Web.UI.WebControls.IPostBackContainer
type DetailsView = class
    inherit CompositeDataBoundControl
    interface IDataItemContainer
    interface INamingContainer
    interface ICallbackContainer
    interface ICallbackEventHandler
    interface IPostBackEventHandler
    interface IPostBackContainer
    interface IDataBoundItemControl
    interface IDataBoundControl
    interface IFieldControl
Public Class DetailsView
Inherits CompositeDataBoundControl
Implements ICallbackContainer, ICallbackEventHandler, IDataBoundItemControl, IDataItemContainer, IFieldControl, IPostBackContainer, IPostBackEventHandler
繼承
屬性
實作

範例

下列程式碼範例示範如何使用, 將DetailsView控制項GridView與簡單的主要詳細案例的控制項搭配使用。The following code example demonstrates how to use to use a DetailsView control in combination with a GridView control for a simple master-detail scenario. 它會顯示在GridView控制項中選取之專案的詳細資料。It displays the details of an item selected in the GridView 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 runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="form1" runat="server">
    <div>
      <table>
        <tr>
          <td>
            <asp:GridView ID="GridView1" runat="server" 
              AutoGenerateColumns="False" DataSourceID="Customers"
              DataKeyNames="CustomerID">
              <Columns>
                <asp:CommandField ShowSelectButton="True" />
                <asp:BoundField DataField="ContactName" HeaderText="ContactName" />
                <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" />
              </Columns>
            </asp:GridView>
          </td>
          <td valign="top">
            <asp:DetailsView ID="DetailsView1" runat="server" 
              AutoGenerateRows="True" DataKeyNames="CustomerID"
              DataSourceID="Details" Height="50px" Width="301px">
            </asp:DetailsView>
          </td>
        </tr>
      </table>
      &nbsp;&nbsp;
      <asp:SqlDataSource ID="Details" runat="server" 
        ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
        SelectCommand="SELECT * FROM [Customers] WHERE ([CustomerID] = @CustomerID)">
        <SelectParameters>
          <asp:ControlParameter ControlID="GridView1" Name="CustomerID" 
            PropertyName="SelectedValue"
            Type="String" />
        </SelectParameters>
      </asp:SqlDataSource>
      <asp:SqlDataSource ID="Customers" runat="server" 
        ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
        SelectCommand="SELECT [CompanyName], [ContactName], [CustomerID] FROM [Customers]">
      </asp:SqlDataSource>
    </div>
  </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 runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="form1" runat="server">
    <div>
      <table>
        <tr>
          <td>
            <asp:GridView ID="GridView1" runat="server" 
              AutoGenerateColumns="False" DataSourceID="Customers"
              DataKeyNames="CustomerID">
              <Columns>
                <asp:CommandField ShowSelectButton="True" />
                <asp:BoundField DataField="ContactName" HeaderText="ContactName" />
                <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" />
              </Columns>
            </asp:GridView>
          </td>
          <td valign="top">
            <asp:DetailsView ID="DetailsView1" runat="server" 
              AutoGenerateRows="True" DataKeyNames="CustomerID"
              DataSourceID="Details" Height="50px" Width="301px">
            </asp:DetailsView>
          </td>
        </tr>
      </table>
      &nbsp;&nbsp;
      <asp:SqlDataSource ID="Details" runat="server" 
        ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
        SelectCommand="SELECT * FROM [Customers] WHERE ([CustomerID] = @CustomerID)">
        <SelectParameters>
          <asp:ControlParameter ControlID="GridView1" Name="CustomerID" 
            PropertyName="SelectedValue"
            Type="String" />
        </SelectParameters>
      </asp:SqlDataSource>
      <asp:SqlDataSource ID="Customers" runat="server" 
        ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
        SelectCommand="SELECT [CompanyName], [ContactName], [CustomerID] FROM [Customers]">
      </asp:SqlDataSource>
    </div>
  </form>
</body>
</html>

下列程式碼範例示範如何使用DetailsView控制項來新增、刪除和編輯記錄。The following code example demonstrates how to use the DetailsView control to add, delete, and edit records.


<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
  void CustomerDetail_ItemInserted(object sender, 
    DetailsViewInsertedEventArgs e)
  {
    // Refresh the GridView control after a new record is inserted 
    // in the DetailsView control.
    CustomersView.DataBind();
  }

  void CustomerDetail_ItemInserting(object sender, 
    DetailsViewInsertEventArgs e)
  {
    // Iterate though the values entered by the user and HTML encode 
    // the values. This helps prevent malicious values from being 
    // stored in the data source.
    for (int i = 0; i < e.Values.Count; i++)
    {
      if (e.Values[i] != null)
      {
        e.Values[i] = Server.HtmlEncode(e.Values[i].ToString());
      }
    }
  }

  void CustomerDetail_ItemUpdated(object sender, 
    DetailsViewUpdatedEventArgs e)
  {
    // Refresh the GridView control after a new record is updated 
    // in the DetailsView control.
    CustomersView.DataBind();
  }

  void CustomerDetail_ItemUpdating(object sender, 
    DetailsViewUpdateEventArgs e)
  {
    // Iterate though the values entered by the user and HTML encode 
    // the values. This helps prevent malicious values from being 
    // stored in the data source.
    for (int i = 0; i < e.NewValues.Count; i++)
    {
      if (e.NewValues[i] != null)
      {
        e.NewValues[i] = Server.HtmlEncode(e.NewValues[i].ToString());
      }
    }
  }

  void CustomerDetail_ItemDeleted(object sender, 
    DetailsViewDeletedEventArgs e)
  {
    // Refresh the GridView control after a new record is updated 
    // in the DetailsView control.
    CustomersView.DataBind();
  }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>
      DetailsView Example</title>
</head>
<body>
  <form id="Form1" runat="server">
    <h3>
      DetailsView Example</h3>
    <table cellspacing="10">
      <tr>
        <td>
          <!-- Use a GridView control in combination with      -->
          <!-- a DetailsView control to display master-detail  -->
          <!-- information. When the user selects a store from -->
          <!-- GridView control, the customers//s detailed     -->
          <!-- information is displayed in the DetailsView     -->
          <!-- control.                                        -->
          <asp:GridView ID="CustomersView" DataSourceID="Customers" 
            AutoGenerateColumns="False"
            DataKeyNames="CustomerID" runat="server">
            <HeaderStyle BackColor="Blue" ForeColor="White" />
            <Columns>
              <asp:CommandField ShowSelectButton="True" />
              <asp:BoundField DataField="ContactName" 
                HeaderText="ContactName" />
              <asp:BoundField DataField="CompanyName" 
                HeaderText="CompanyName" />
            </Columns>
          </asp:GridView>
        </td>
        <td valign="top">
          <asp:DetailsView ID="CustomerDetail" 
            DataSourceID="Details" AutoGenerateRows="false"
            AutoGenerateInsertButton="true" 
            AutoGenerateEditButton="true" 
            AutoGenerateDeleteButton="true"
            EmptyDataText="No records." 
            DataKeyNames="CustomerID" GridLines="Both" 
            OnItemInserted="CustomerDetail_ItemInserted"
            OnItemInserting="CustomerDetail_ItemInserting" 
            OnItemUpdated="CustomerDetail_ItemUpdated"
            OnItemUpdating="CustomerDetail_ItemUpdating" 
            OnItemDeleted="CustomerDetail_ItemDeleted"
            runat="server">
            <HeaderStyle BackColor="Navy" ForeColor="White" />
            <RowStyle BackColor="White" />
            <AlternatingRowStyle BackColor="LightGray" />
            <EditRowStyle BackColor="LightCyan" />
            <Fields>
              <asp:BoundField DataField="CustomerID" HeaderText="CustomerID" ReadOnly="True" />
              <asp:BoundField DataField="ContactName" HeaderText="ContactName" />
              <asp:BoundField DataField="ContactTitle" HeaderText="ContactTitle" />
              <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" />
              <asp:BoundField DataField="Address" HeaderText="Address" />
              <asp:BoundField DataField="City" HeaderText="City" />
              <asp:BoundField DataField="Region" HeaderText="Region" />
              <asp:BoundField DataField="PostalCode" HeaderText="PostalCode" />
              <asp:BoundField DataField="Country" HeaderText="Country" />
              <asp:BoundField DataField="Phone" HeaderText="Phone" />
              <asp:BoundField DataField="Fax" HeaderText="Fax" />
            </Fields>
          </asp:DetailsView>
        </td>
      </tr>
    </table>
    <!-- This example uses Microsoft SQL Server and connects -->
    <!-- to the Northwind sample database.                   -->
    <!-- It is strongly recommended that each data-bound     -->
    <!-- control uses a separate data source control.        -->
    <asp:SqlDataSource ID="Customers" runat="server" 
      ConnectionString=
        "<%$ ConnectionStrings:NorthwindConnectionString %>"
      SelectCommand="SELECT [CompanyName], [ContactName], [CustomerID] 
        FROM [Customers]">
    </asp:SqlDataSource>
    <!-- Add a filter to the data source control for the     -->
    <!-- DetailsView control to display the details of the   -->
    <!-- store selected in the GridView control.             -->
    <asp:SqlDataSource ID="Details" 
      ConnectionString=
        "<%$ ConnectionStrings:NorthwindConnectionString %>"
      runat="server" 
      SelectCommand="SELECT * FROM [Customers] 
        WHERE ([CustomerID] = @CustomerID)"
      DeleteCommand="DELETE FROM [Customers] 
        WHERE [CustomerID] = @CustomerID"
      InsertCommand="INSERT INTO [Customers] ([CustomerID], 
        [CompanyName], [ContactName], [ContactTitle], [Address], 
        [City], [Region], [PostalCode], [Country], [Phone], [Fax]) 
        VALUES (@CustomerID, @CompanyName, @ContactName, @ContactTitle, 
        @Address, @City, @Region, @PostalCode, @Country, @Phone, @Fax)"
      UpdateCommand="UPDATE [Customers] SET [CompanyName] = @CompanyName, 
        [ContactName] = @ContactName, [ContactTitle] = @ContactTitle, 
        [Address] = @Address, [City] = @City, [Region] = @Region, 
        [PostalCode] = @PostalCode, [Country] = @Country, 
        [Phone] = @Phone, [Fax] = @Fax 
        WHERE [CustomerID] = @CustomerID">
      <SelectParameters>
        <asp:ControlParameter ControlID="CustomersView" 
          Name="CustomerID" PropertyName="SelectedValue"
          Type="String" />
      </SelectParameters>
      <DeleteParameters>
        <asp:Parameter Name="CustomerID" Type="String" />
      </DeleteParameters>
      <UpdateParameters>
        <asp:Parameter Name="CompanyName" Type="String" />
        <asp:Parameter Name="ContactName" Type="String" />
        <asp:Parameter Name="ContactTitle" Type="String" />
        <asp:Parameter Name="Address" Type="String" />
        <asp:Parameter Name="City" Type="String" />
        <asp:Parameter Name="Region" Type="String" />
        <asp:Parameter Name="PostalCode" Type="String" />
        <asp:Parameter Name="Country" Type="String" />
        <asp:Parameter Name="Phone" Type="String" />
        <asp:Parameter Name="Fax" Type="String" />
        <asp:Parameter Name="CustomerID" Type="String" />
      </UpdateParameters>
      <InsertParameters>
        <asp:Parameter Name="CustomerID" Type="String" />
        <asp:Parameter Name="CompanyName" Type="String" />
        <asp:Parameter Name="ContactName" Type="String" />
        <asp:Parameter Name="ContactTitle" Type="String" />
        <asp:Parameter Name="Address" Type="String" />
        <asp:Parameter Name="City" Type="String" />
        <asp:Parameter Name="Region" Type="String" />
        <asp:Parameter Name="PostalCode" Type="String" />
        <asp:Parameter Name="Country" Type="String" />
        <asp:Parameter Name="Phone" Type="String" />
        <asp:Parameter Name="Fax" Type="String" />
      </InsertParameters>
    </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">
<script runat="server">
  Sub CustomerDetail_ItemInserted(ByVal sender As Object, _
    ByVal e As DetailsViewInsertedEventArgs)
    ' Refresh the GridView control after a new record is inserted in 
    ' the DetailsView control.
    CustomersView.DataBind()
  End Sub
  
  Sub CustomerDetail_ItemInserting(ByVal sender As Object, _
    ByVal e As DetailsViewInsertEventArgs)
    ' Iterate though the values entered by the user and HTML encode 
    ' the values. This helps prevent malicious values from being 
    ' stored in the data source.
    For i As Integer = 0 To e.Values.Count - 1
      If e.Values(i) IsNot Nothing Then
        e.Values(i) = Server.HtmlEncode(e.Values(i).ToString())
      End If
    Next
  End Sub
  
  Sub CustomerDetail_ItemUpdated(ByVal sender As Object, _
    ByVal e As DetailsViewUpdatedEventArgs)
    ' Refresh the GridView control after a new record is updated 
    ' in the DetailsView control.
    CustomersView.DataBind()
  End Sub
  
  Sub CustomerDetail_ItemUpdating(ByVal sender As Object, _
    ByVal e As DetailsViewUpdateEventArgs)
    ' Iterate though the values entered by the user and HTML encode 
    ' the values. This helps prevent malicious values from being 
    ' stored in the data source.
    For i As Integer = 0 To e.NewValues.Count - 1
      If e.NewValues(i) IsNot Nothing Then
        e.NewValues(i) = Server.HtmlEncode(e.NewValues(i).ToString())
      End If
    Next
  End Sub
  
  Sub CustomerDetail_ItemDeleted(ByVal sender As Object, _
    ByVal e As DetailsViewDeletedEventArgs)
    ' Refresh the GridView control after a new record is updated 
    ' in the DetailsView control.
    CustomersView.DataBind()
  End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>DetailsView Example</title>
</head>
<body>
  <form id="Form1" runat="server">
    <h3>DetailsView Example</h3>
    <table cellspacing="10">
      <tr>
        <td>
          <!-- Use a GridView control in combination with      -->
          <!-- a DetailsView control to display master-detail  -->
          <!-- information. When the user selects a store from -->
          <!-- GridView control, the customers's detailed      -->
          <!-- information is displayed in the DetailsView     -->
          <!-- control.                                        -->
          <asp:GridView ID="CustomersView" DataSourceID="Customers" 
            AutoGenerateColumns="False"
            DataKeyNames="CustomerID" runat="server">
            <HeaderStyle BackColor="Blue" ForeColor="White" />
            <Columns>
              <asp:CommandField ShowSelectButton="True" />
              <asp:BoundField DataField="ContactName" 
                HeaderText="ContactName" />
              <asp:BoundField DataField="CompanyName" 
                HeaderText="CompanyName" />
            </Columns>
          </asp:GridView>
        </td>
        <td valign="top">
          <asp:DetailsView ID="CustomerDetail" DataSourceID="Details" 
            AutoGenerateRows="false"
            AutoGenerateInsertButton="true" 
            AutoGenerateEditButton="true" 
            AutoGenerateDeleteButton="true"
            EmptyDataText="No records." 
            DataKeyNames="CustomerID" GridLines="Both" 
            OnItemInserted="CustomerDetail_ItemInserted"
            OnItemInserting="CustomerDetail_ItemInserting" 
            OnItemUpdated="CustomerDetail_ItemUpdated"
            OnItemUpdating="CustomerDetail_ItemUpdating" 
            OnItemDeleted="CustomerDetail_ItemDeleted"
            runat="server">
            <HeaderStyle BackColor="Navy" ForeColor="White" />
            <RowStyle BackColor="White" />
            <AlternatingRowStyle BackColor="LightGray" />
            <EditRowStyle BackColor="LightCyan" />
            <Fields>
              <asp:BoundField DataField="CustomerID" HeaderText="CustomerID" 
                ReadOnly="True" />
              <asp:BoundField DataField="ContactName" HeaderText="ContactName" />
              <asp:BoundField DataField="ContactTitle" HeaderText="ContactTitle" />
              <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" />
              <asp:BoundField DataField="Address" HeaderText="Address" />
              <asp:BoundField DataField="City" HeaderText="City" />
              <asp:BoundField DataField="Region" HeaderText="Region" />
              <asp:BoundField DataField="PostalCode" HeaderText="PostalCode" />
              <asp:BoundField DataField="Country" HeaderText="Country" />
              <asp:BoundField DataField="Phone" HeaderText="Phone" />
              <asp:BoundField DataField="Fax" HeaderText="Fax" />
            </Fields>
          </asp:DetailsView>
        </td>
      </tr>
    </table>
    <!-- This example uses Microsoft SQL Server and connects -->
    <!-- to the Northwind sample database.                   -->
    <!-- It is strongly recommended that each data-bound     -->
    <!-- control uses a separate data source control.        -->
    <asp:SqlDataSource ID="Customers" runat="server" 
      ConnectionString=
        "<%$ ConnectionStrings:NorthwindConnectionString %>"
      SelectCommand="SELECT [CompanyName], [ContactName], [CustomerID] 
        FROM [Customers]">
    </asp:SqlDataSource>
    <!-- Add a filter to the data source control for the     -->
    <!-- DetailsView control to display the details of the   -->
    <!-- store selected in the GridView control.             -->
    <asp:SqlDataSource ID="Details" 
      ConnectionString=
        "<%$ ConnectionStrings:NorthwindConnectionString %>"
      runat="server" 
      SelectCommand="SELECT * FROM [Customers] 
        WHERE ([CustomerID] = @CustomerID)"
      DeleteCommand="DELETE FROM [Customers] 
        WHERE [CustomerID] = @CustomerID"
      InsertCommand="INSERT INTO [Customers] ([CustomerID], 
        [CompanyName], [ContactName], [ContactTitle], [Address], 
        [City], [Region], [PostalCode], [Country], [Phone], [Fax]) 
        VALUES (@CustomerID, @CompanyName, @ContactName, 
        @ContactTitle, @Address, @City, @Region, @PostalCode, 
        @Country, @Phone, @Fax)"
      UpdateCommand="UPDATE [Customers] SET 
        [CompanyName] = @CompanyName, 
        [ContactName] = @ContactName, [ContactTitle] = @ContactTitle, 
        [Address] = @Address, [City] = @City, [Region] = @Region, 
        [PostalCode] = @PostalCode, [Country] = @Country, 
        [Phone] = @Phone, [Fax] = @Fax 
        WHERE [CustomerID] = @CustomerID">
      <SelectParameters>
        <asp:ControlParameter ControlID="CustomersView" 
          Name="CustomerID" PropertyName="SelectedValue"
          Type="String" />
      </SelectParameters>
      <DeleteParameters>
        <asp:Parameter Name="CustomerID" Type="String" />
      </DeleteParameters>
      <UpdateParameters>
        <asp:Parameter Name="CompanyName" Type="String" />
        <asp:Parameter Name="ContactName" Type="String" />
        <asp:Parameter Name="ContactTitle" Type="String" />
        <asp:Parameter Name="Address" Type="String" />
        <asp:Parameter Name="City" Type="String" />
        <asp:Parameter Name="Region" Type="String" />
        <asp:Parameter Name="PostalCode" Type="String" />
        <asp:Parameter Name="Country" Type="String" />
        <asp:Parameter Name="Phone" Type="String" />
        <asp:Parameter Name="Fax" Type="String" />
        <asp:Parameter Name="CustomerID" Type="String" />
      </UpdateParameters>
      <InsertParameters>
        <asp:Parameter Name="CustomerID" Type="String" />
        <asp:Parameter Name="CompanyName" Type="String" />
        <asp:Parameter Name="ContactName" Type="String" />
        <asp:Parameter Name="ContactTitle" Type="String" />
        <asp:Parameter Name="Address" Type="String" />
        <asp:Parameter Name="City" Type="String" />
        <asp:Parameter Name="Region" Type="String" />
        <asp:Parameter Name="PostalCode" Type="String" />
        <asp:Parameter Name="Country" Type="String" />
        <asp:Parameter Name="Phone" Type="String" />
        <asp:Parameter Name="Fax" Type="String" />
      </InsertParameters>
    </asp:SqlDataSource>
  </form>
</body>
</html>

下列程式碼範例示範如何以宣告方式將資料欄欄位DetailsView加入至控制項。The following code example demonstrates how to declaratively add row fields to the DetailsView 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 runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="Form1" runat="server">
    <table cellspacing="10">
      <tr>
        <td>
          <!-- Use a GridView control in combination with      -->
          <!-- a DetailsView control to display master-detail  -->
          <!-- information. When the user selects a store from -->
          <!-- GridView control, the store's detailed          -->
          <!-- information is displayed in the DetailsView     -->
          <!-- control.                                        -->
          <asp:GridView ID="GridView1" runat="server" 
            DataSourceID="Customers" AutoGenerateColumns="False" 
            DataKeyNames="CustomerID">
            <Columns>
              <asp:CommandField ShowSelectButton="True" />
              <asp:BoundField DataField="ContactName" HeaderText="ContactName" />
              <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" />
            </Columns>
          </asp:GridView>
        </td>
        <td valign="top">
          <asp:DetailsView ID="DetailsView" runat="server"
            DataSourceID="Details" AutoGenerateRows="false"
            DataKeyNames="CustomerID" >
            <HeaderStyle BackColor="Navy" ForeColor="White" />
            <Fields>
              <asp:BoundField DataField="CustomerID" HeaderText="CustomerID" 
                ReadOnly="True" />
              <asp:BoundField DataField="ContactName" HeaderText="ContactName" />
              <asp:BoundField DataField="ContactTitle" HeaderText="ContactTitle" />
              <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" />
              <asp:BoundField DataField="City" HeaderText="City" />
              <asp:BoundField DataField="Region" HeaderText="Region" />
              <asp:BoundField DataField="PostalCode" HeaderText="PostalCode" />
              <asp:BoundField DataField="Country" HeaderText="Country" />
            </Fields>
          </asp:DetailsView>
        </td>
      </tr>
    </table>
    <!-- This example uses Microsoft SQL Server and connects -->
    <!-- to the Northwind sample database.                        -->
    <!-- It is strongly recommended that each data-bound     -->
    <!-- control uses a separate data source control.        -->
    <asp:SqlDataSource ID="Customers" runat="server" 
      ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
      SelectCommand="SELECT [CompanyName], [ContactName], [CustomerID] FROM [Customers]">
    </asp:SqlDataSource>
    <!-- Add a filter to the data source control for the     -->
    <!-- DetailsView control to display the details of the   -->
    <!-- store selected in the GridView control.             -->
    <asp:SqlDataSource ID="Details" runat="server" 
      ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
      SelectCommand="SELECT * FROM [Customers] WHERE ([CustomerID] = @CustomerID)">
      <SelectParameters>
        <asp:ControlParameter ControlID="GridView1" Name="CustomerID" 
          PropertyName="SelectedValue"
          Type="String" />
      </SelectParameters>
    </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 runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="Form1" runat="server">
    <table cellspacing="10">
      <tr>
        <td>
          <!-- Use a GridView control in combination with      -->
          <!-- a DetailsView control to display master-detail  -->
          <!-- information. When the user selects a store from -->
          <!-- GridView control, the store's detailed          -->
          <!-- information is displayed in the DetailsView     -->
          <!-- control.                                        -->
          <asp:GridView ID="GridView1" runat="server" 
            DataSourceID="Customers" AutoGenerateColumns="False" 
            DataKeyNames="CustomerID">
            <Columns>
              <asp:CommandField ShowSelectButton="True" />
              <asp:BoundField DataField="ContactName" HeaderText="ContactName" />
              <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" />
            </Columns>
          </asp:GridView>
        </td>
        <td valign="top">
          <asp:DetailsView ID="DetailsView" runat="server"
            DataSourceID="Details" AutoGenerateRows="false"
            DataKeyNames="CustomerID" >
            <HeaderStyle BackColor="Navy" ForeColor="White" />
            <Fields>
              <asp:BoundField DataField="CustomerID" HeaderText="CustomerID" 
                ReadOnly="True" />
              <asp:BoundField DataField="ContactName" HeaderText="ContactName" />
              <asp:BoundField DataField="ContactTitle" HeaderText="ContactTitle" />
              <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" />
              <asp:BoundField DataField="City" HeaderText="City" />
              <asp:BoundField DataField="Region" HeaderText="Region" />
              <asp:BoundField DataField="PostalCode" HeaderText="PostalCode" />
              <asp:BoundField DataField="Country" HeaderText="Country" />
            </Fields>
          </asp:DetailsView>
        </td>
      </tr>
    </table>
    <!-- This example uses Microsoft SQL Server and connects -->
    <!-- to the Northwind sample database.                        -->
    <!-- It is strongly recommended that each data-bound     -->
    <!-- control uses a separate data source control.        -->
    <asp:SqlDataSource ID="Customers" runat="server" 
      ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
      SelectCommand="SELECT [CompanyName], [ContactName], [CustomerID] FROM [Customers]">
    </asp:SqlDataSource>
    <!-- Add a filter to the data source control for the     -->
    <!-- DetailsView control to display the details of the   -->
    <!-- store selected in the GridView control.             -->
    <asp:SqlDataSource ID="Details" runat="server" 
      ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
      SelectCommand="SELECT * FROM [Customers] WHERE ([CustomerID] = @CustomerID)">
      <SelectParameters>
        <asp:ControlParameter ControlID="GridView1" Name="CustomerID" 
          PropertyName="SelectedValue"
          Type="String" />
      </SelectParameters>
    </asp:SqlDataSource>
  </form>
</body>
</html>

備註

本主題內容:In this topic:

簡介Introduction

DetailsView控制項是用來從資料表中的資料來源顯示單一記錄, 其中記錄的每個欄位都會顯示在資料表的一列中。The DetailsView control is used to display a single record from a data source in a table, where each field of the record is displayed in a row of the table. 它可以與GridView主版詳細案例的控制項搭配使用。It can be used in combination with a GridView control for master-detail scenarios. DetailsView控制項支援下列功能:The DetailsView control supports the following features:

  • 系結至資料來源控制項, 例如SqlDataSourceBinding to data source controls, such as SqlDataSource.

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

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

  • 內建分頁功能。Built-in paging capabilities.

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

  • 透過主題和樣式可自訂的外觀。Customizable appearance through themes and styles.

資料欄欄位Row Fields

控制項中的DetailsView每個資料列都是藉由宣告欄位控制項來建立。Each data row in the DetailsView control is created by declaring a field control. 不同的資料欄欄位類型決定了控制項中資料列的行為。Different row field types determine the behavior of the rows in the control. 欄位控制項衍生自DataControlFieldField controls derive from DataControlField. 下表列出可以使用的不同資料欄欄位類型。The following table lists the different row field types that can be used.

資料列欄位類型Column field type 說明Description
BoundField 將資料來源中的欄位值顯示為文字。Displays the value of a field in a data source as text.
ButtonField DetailsView控制項中顯示命令按鈕。Displays a command button in the DetailsView control. 這可讓您顯示具有自訂按鈕控制項的資料列, 例如 [加入] 或 [移除] 按鈕。This allows you to display a row with a custom button control, such as an Add or a Remove button.
CheckBoxField DetailsView控制項中顯示覆選框。Displays a check box in the DetailsView control. 此資料欄欄位類型通常用來顯示包含布林值的欄位。This row field type is commonly used to display fields with a Boolean value.
CommandField 顯示內建的命令按鈕, 以在DetailsView控制項中執行編輯、插入或刪除作業。Displays built-in command buttons to perform edit, insert, or delete operations in the DetailsView control.
HyperLinkField 將資料來源中的欄位值顯示為超連結。Displays the value of a field in a data source as a hyperlink. 此資料欄欄位類型可讓您將第二個欄位系結至超連結的 URL。This row field type allows you to bind a second field to the hyperlink's URL.
ImageField DetailsView控制項中顯示影像。Displays an image in the DetailsView control.
TemplateField 根據指定的範本, 顯示DetailsView控制項中資料列的使用者定義內容。Displays user-defined content for a row in the DetailsView control according to a specified template. 此資料欄欄位類型可讓您建立自訂的資料欄欄位。This row field type allows you to create a custom row field.

根據預設, AutoGenerateRows屬性會設定為true, 它會針對資料來源中可系結類型的每個欄位, 自動產生系結的資料欄欄位物件。By default, the AutoGenerateRows property is set to true, which automatically generates a bound row field object for each field of a bindable type in the data source. 有效的可系StringDateTime類型為Guid、、 Decimal、和一組基本類型。Valid bindable types are String, DateTime, Decimal, Guid, and the set of primitive types. 然後每個欄位都會以文字的形式顯示在資料列中, 而每個欄位的順序會依每個欄位出現在資料來源中。Each field is then displayed in a row as text, in the order in which each field appears in the data source.

自動產生資料列提供快速且簡單的方式來顯示記錄中的每個欄位。Automatically generating the rows provides a quick and easy way to display every field in the record. 不過, 若要利用DetailsView控制項的先進功能, 您必須明確宣告要包含DetailsView在控制項中的資料欄欄位。However, to make use of the DetailsView control's advanced capabilities you must explicitly declare the row fields to include in the DetailsView control. 若要宣告資料欄欄位, 請先AutoGenerateRows將屬性false設定為。To declare the row fields, first set the AutoGenerateRows property to false. 接下來, 在<Fields> DetailsView控制項的開頭和結束記號之間加入開頭和結束記號。Next, add opening and closing <Fields> tags between the opening and closing tags of the DetailsView control. 最後, 列出您要包含在開頭和結尾<Fields>標記之間的資料欄欄位。Finally, list the row fields that you want to include between the opening and closing <Fields> tags. 指定的資料欄欄位會依照列出Fields的順序新增至集合。The row fields specified are added to the Fields collection in the order listed. 集合可讓您以程式設計方式管理DetailsView控制項中的資料欄欄位。 FieldsThe Fields collection allows you to programmatically manage the row fields in the DetailsView control.

注意

自動產生的Fields資料欄欄位不會加入至集合。Automatically generated row fields are not added to the Fields collection.

注意

明確宣告的資料欄欄位可以與自動產生的資料欄欄位一起顯示。Explicitly declared row fields can be displayed in combination with automatically generated row fields. 當使用這兩者時, 會先轉譯明確宣告的資料欄欄位, 接著再轉譯自動產生的資料欄欄位。When both are used, explicitly declared row fields are rendered first, followed by the automatically generated row fields.

系結至資料Binding to Data

System.Collections.IEnumerable ObjectDataSource SqlDataSource System.Collections.ArrayList System.Data.DataView控制項可以系結至資料來源控制項 (例如控制項或控制項), 或系結至任何可執行介面的資料來源集合, 例如、、 DetailsView System.Collections.Generic.List<T>或其他集合類型。The DetailsView control can be bound 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. 使用下列其中一種方法, DetailsView將控制項系結至適當的資料來源類型:Use one of the following methods to bind the DetailsView control to the appropriate data source type:

如需資料系結的詳細資訊, 請參閱系結至資料庫For more information on data binding, see Binding to Databases.

安全性Security

這個控制項可以用來顯示使用者輸入, 其中可能包含惡意的用戶端腳本。This 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 displaying it in your application. ASP.NET 提供輸入要求驗證功能, 以封鎖使用者輸入中的腳本和 HTML。ASP.NET provides an input request validation feature to block script and HTML in user input. 如需詳細資訊,請參閱 Script Exploits Overview (指令碼攻擊概觀)。For more information, see Script Exploits Overview. 也會提供驗證服務器控制項來評估使用者輸入。Validation server controls are also provided to assess user input. 如需詳細資訊, 請參閱驗證服務器控制項語法For more information, see Validation Server Control Syntax.

資料作業Data Operations

DetailsView控制項提供內建功能, 可讓使用者更新、刪除、插入及逐頁流覽控制項中的專案。The DetailsView control provides built-in capabilities that allow the user to update, delete, insert, and page through items in the control. 當控制項系結至資料來源控制項時DetailsView , 控制項可以利用資料來源控制項的功能, 並提供自動更新、刪除、插入和分頁功能。 DetailsViewWhen the DetailsView control is bound to a data source control, the DetailsView control can take advantage of the data source control's capabilities and provide automatic updating, deleting, inserting, and paging functionality.

注意

DetailsView控制項可以支援使用其他資料來源類型的更新、刪除、插入及分頁作業; 不過, 您必須在適當的事件處理常式中提供這些作業的執行。The DetailsView control can provide support for update, delete, insert, and paging operations with other types of data sources; however, you must provide the implementation for these operations in an appropriate event handler. 如需詳細資訊,請參閱ItemDeletingItemInsertingItemUpdatingFor more information, see ItemDeleting, ItemInserting, and ItemUpdating.

AutoGenerateEditButton CommandField 控制項可以AutoGenerateDeleteButton將、或屬性分別true設定為, 以自動加入具有 [編輯]、[刪除] 或 [新增] 按鈕的資料欄欄位。 AutoGenerateInsertButton DetailsViewThe DetailsView control can automatically add a CommandField row field with an Edit, Delete, or New button by setting the AutoGenerateEditButton, AutoGenerateDeleteButton, or AutoGenerateInsertButton properties to true, respectively. 不同于 [刪除] 按鈕 (會立即刪除選取的記錄), 按一下DetailsView [編輯] 或 [新增] 按鈕時, 控制項會分別進入 [編輯] 或 [插入] 模式。Unlike the Delete button (which deletes the selected record immediately), when the Edit or New button is clicked, the DetailsView control goes into edit or insert mode, respectively. 在編輯模式中, [編輯] 按鈕會取代為 [更新] 和 [取消] 按鈕。In edit mode, the Edit button is replaced with an Update and a Cancel button. 欄位的資料類型 (例如TextBox CheckBox或控制項) 適用的輸入控制項, 會顯示欄位的值供使用者修改。Input controls that are appropriate for the field's data type (such as a TextBox or a CheckBox control) are displayed with a field's value for the user to modify. 按一下 [更新] 按鈕會更新資料來源中的記錄, 而按一下 [取消] 按鈕會放棄任何變更。Clicking the Update button updates the record in the data source, while clicking the Cancel button abandons any changes. 同樣地, 在插入模式中, 會使用 [插入] 和 [取消] 按鈕取代 [新增] 按鈕, 並顯示空的輸入控制項, 讓使用者輸入新記錄的值。Likewise, in insert mode, the New button is replaced with an Insert and a Cancel button, and empty input controls are displayed for the user to enter the values for the new record.

注意

您也可以手動定義ButtonFieldCommandFieldTemplateField資料欄欄位中的 [更新]、[刪除] 和 [插入] 命令按鈕。You can also manually define the update, delete, and insert command buttons in a ButtonField, CommandField, or TemplateField row field. 控制項可辨識CommandName屬性設定為 "Edit"、"Update"、"Delete"、"New"、"Insert" 或 "Cancel" 的按鈕; 不過, 您仍然必須自行提供功能。 DetailsViewThe DetailsView control recognizes buttons with the CommandName property set to "Edit", "Update", "Delete", "New", "Insert", or "Cancel"; however, you still must provide the functionality yourself. 如需詳細資訊,請參閱ItemDeletingItemInsertingItemUpdatingFor more information, see ItemDeleting, ItemInserting, and ItemUpdating.

DetailsView控制項提供分頁功能, 可讓使用者流覽至資料來源中的其他記錄。The DetailsView control provides a paging feature, which allows the user to navigate to other records in the data source. 啟用時, 頁面導覽控制項就會顯示在 [呼機] 資料列中。When enabled, page navigation controls are displayed in a pager row. 若要啟用分頁, 請AllowPaging將屬性true設定為。To enable paging, set the AllowPaging property to true. 您可以使用PagerStylePagerSettings屬性自訂分頁資料列。The pager row can be customized using the PagerStyle and PagerSettings properties.

自訂使用者介面Customizing the User Interface

您可以針對控制項的不同部分DetailsView設定樣式屬性, 以自訂控制項的外觀。You can customize the appearance of the DetailsView control by setting the style properties for different parts of the control. 下表列出您可以設定的樣式屬性。The following table lists the style properties that you can set.

Style 屬性Style property 說明Description
AlternatingRowStyle DetailsView控制項中交替資料列的樣式設定。The style settings for the alternating data rows in the DetailsView control. 設定此屬性時, 資料列會顯示在群組中, RowStyle AlternatingRowStyle並在設定和設定之間交替。When this property is set, the data rows are displayed in bands, alternating between the RowStyle settings and the AlternatingRowStyle settings.
CommandRowStyle 包含內建命令按鈕之資料列的樣式設定。The style settings for the row that contains the built-in command buttons.
EditRowStyle DetailsView控制項處於編輯模式時, 資料列的樣式設定。The style settings for the data rows when the DetailsView control is in edit mode.
EmptyDataRowStyle 當資料來源不包含任何記錄時, DetailsView控制項中顯示之空白資料列的樣式設定。The style settings for the empty data row that are displayed in the DetailsView control when the data source does not contain any records.
FooterStyle 頁尾資料列的樣式設定。The style settings for the footer row.
HeaderStyle 標頭資料列的樣式設定。The style settings for the header row.
InsertRowStyle DetailsView控制項處於插入模式時, 資料列的樣式設定。The style settings for the data rows when the DetailsView control is in insert mode.
PagerStyle 分頁資料列的樣式設定。The style settings for the pager row.
RowStyle DetailsView控制項中資料列的樣式設定。The style settings for the data rows in the DetailsView control. 當屬性也設定時, 資料列會在RowStyle設定和AlternatingRowStyle設定之間交替顯示。 AlternatingRowStyleWhen the AlternatingRowStyle property is also set, the data rows are displayed alternating between the RowStyle settings and the AlternatingRowStyle settings.
FieldHeaderStyle 標頭資料行的樣式設定。The style settings for the header column.

事件Events

DetailsView控制項提供幾個您可以針對進行程式設計的事件。The DetailsView control provides several events that you can program against. 這可讓您在每次發生事件時執行自訂常式。This allows you to run a custom routine whenever an event occurs. 下表列出DetailsView控制項支援的事件。The following table lists the events supported by the DetailsView control. Init DataBinding Load Disposed DataBound控制項也Render會從其基類繼承這些事件:PreRender、、、、、和。 DetailsViewThe DetailsView control also inherits these events from its base classes: DataBinding, DataBound, Disposed, Init, Load, PreRender, and Render.

Event - 事件Event 描述Description
ItemCommand 按一下 DetailsView 控制項中的按鈕時會發生這個事件。Occurs when a button is clicked in the DetailsView control.
ItemCreated DetailsViewRow 控制項DetailsView中建立所有物件之後發生。Occurs after all DetailsViewRow objects are created in the DetailsView control. 此事件通常用來在顯示記錄之前修改其值。This event is often used to modify the values of a record before it is displayed.
ItemDeleted 發生于按一下 [ DetailsView刪除] 按鈕時, 但在控制項從資料來源中刪除記錄之後。Occurs when a Delete button is clicked, but after the DetailsView control deletes the record from the data source. 這個事件通常用來檢查刪除作業的結果。This event is often used to check the results of the delete operation.
ItemDeleting 發生于按一下 [ DetailsView刪除] 按鈕時, 但在控制項從資料來源刪除記錄之前。Occurs when a Delete button is clicked, but before the DetailsView control deletes the record from the data source. 這個事件通常用來取消刪除作業。This event is often used to cancel the delete operation.
ItemInserted 發生于按一下 [ DetailsView插入] 按鈕時, 但在控制項插入記錄之後。Occurs when an Insert button is clicked, but after the DetailsView control inserts the record. 這個事件通常用來檢查插入作業的結果。This event is often used to check the results of the insert operation.
ItemInserting 發生于按一下 [ DetailsView插入] 按鈕時, 但在控制項插入記錄之前。Occurs when an Insert button is clicked, but before the DetailsView control inserts the record. 這個事件通常用來取消插入作業。This event is often used to cancel the insert operation.
ItemUpdated 發生于按一下 [ DetailsView更新] 按鈕時, 但在控制項更新資料列之後。Occurs when an Update button is clicked, but after the DetailsView control updates the row. 此事件通常用來檢查更新作業的結果。This event is often used to check the results of the update operation.
ItemUpdating 發生于按一下 [ DetailsView更新] 按鈕時, 但在控制項更新記錄之前。Occurs when an Update button is clicked, but before the DetailsView control updates the record. 此事件通常用來取消更新作業。This event is often used to cancel the update operation.
ModeChanged 發生于控制項DetailsView變更模式 ([編輯]、[插入] 或 [唯讀] 模式) 之後。Occurs after the DetailsView control changes modes (edit, insert, or read-only mode). DetailsView控制項變更模式時, 通常會使用這個事件來執行工作。This event is often used to perform a task when the DetailsView control changes modes.
ModeChanging 發生于控制項DetailsView變更模式 ([編輯]、[插入] 或 [唯讀] 模式) 之前。Occurs before the DetailsView control changes modes (edit, insert, or read-only mode). 這個事件通常用來取消模式變更。This event is often used to cancel a mode change.
PageIndexChanged 按一下其中一個頁面巡覽區按鈕時發生 (但在 DetailsView 控制項處理分頁作業之後)。Occurs when one of the pager buttons is clicked, but after the DetailsView control handles the paging operation. 當您需要在使用者導覽至控制項中的不同記錄之後執行工作時, 通常會使用這個事件。This event is commonly used when you need to perform a task after the user navigates to a different record in the control.
PageIndexChanging 發生於按一下其中一個頁面巡覽區按鈕時,但是在 DetailsView 控制項處理分頁作業之前。Occurs when one of the pager buttons is clicked, but before the DetailsView control handles the paging operation. 此事件通常用來取消分頁作業。This event is often used to cancel the paging operation.

協助工具選項Accessibility

如需如何設定此控制項, 使其產生符合協助工具標準之標記的詳細資訊, 請參閱Visual Studio 和 ASP.NETASP.NET 控制項和協助工具中的協助工具。For information about how to configure this control so that it generates markup that conforms to accessibility standards, see Accessibility in Visual Studio and ASP.NET and ASP.NET Controls and Accessibility.

宣告式語法Declarative Syntax

<asp:DetailsView  
    AccessKey="string"  
    AllowPaging="True|False"  
    AutoGenerateDeleteButton="True|False"  
    AutoGenerateEditButton="True|False"  
    AutoGenerateInsertButton="True|False"  
    AutoGenerateRows="True|False"  
    BackColor="color name|#dddddd"  
    BackImageUrl="uri"  
    BorderColor="color name|#dddddd"  
    BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge|  
        Inset|Outset"  
    BorderWidth="size"  
    Caption="string"  
    CaptionAlign="NotSet|Top|Bottom|Left|Right"  
    CellPadding="integer"  
    CellSpacing="integer"  
    CssClass="string"  
    DataKeyNames="string"  
    DataMember="string"  
    DataSource="string"  
    DataSourceID="string"  
    DefaultMode="ReadOnly|Edit|Insert"  
    EmptyDataText="string"  
    Enabled="True|False"  
    EnablePagingCallbacks="True|False"  
    EnableTheming="True|False"  
    EnableViewState="True|False"  
    Font-Bold="True|False"  
    Font-Italic="True|False"  
    Font-Names="string"  
    Font-Overline="True|False"  
    Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium|  
        Large|X-Large|XX-Large"  
    Font-Strikeout="True|False"  
    Font-Underline="True|False"  
    FooterText="string"  
    ForeColor="color name|#dddddd"  
    GridLines="None|Horizontal|Vertical|Both"  
    HeaderText="string"  
    Height="size"  
    HorizontalAlign="NotSet|Left|Center|Right|Justify"  
    ID="string"  
    OnDataBinding="DataBinding event handler"  
    OnDataBound="DataBound event handler"  
    OnDisposed="Disposed event handler"  
    OnInit="Init event handler"  
    OnItemCommand="ItemCommand event handler"  
    OnItemCreated="ItemCreated event handler"  
    OnItemDeleted="ItemDeleted event handler"  
    OnItemDeleting="ItemDeleting event handler"  
    OnItemInserted="ItemInserted event handler"  
    OnItemInserting="ItemInserting event handler"  
    OnItemUpdated="ItemUpdated event handler"  
    OnItemUpdating="ItemUpdating event handler"  
    OnLoad="Load event handler"  
    OnModeChanged="ModeChanged event handler"  
    OnModeChanging="ModeChanging event handler"  
    OnPageIndexChanged="PageIndexChanged event handler"  
    OnPageIndexChanging="PageIndexChanging event handler"  
    OnPreRender="PreRender event handler"  
    OnUnload="Unload event handler"  
    PageIndex="integer"  
    PagerSettings-FirstPageImageUrl="uri"  
    PagerSettings-FirstPageText="string"  
    PagerSettings-LastPageImageUrl="uri"  
    PagerSettings-LastPageText="string"  
    PagerSettings-Mode="NextPrevious|Numeric|NextPreviousFirstLast|NumericFirstLast"  
    PagerSettings-NextPageImageUrl="uri"  
    PagerSettings-NextPageText="string"  
    PagerSettings-PageButtonCount="integer"  
    PagerSettings-Position="Bottom|Top|TopAndBottom"  
    PagerSettings-PreviousPageImageUrl="uri"  
    PagerSettings-PreviousPageText="string"  
    PagerSettings-Visible="True|False"  
    runat="server"  
    SkinID="string"  
    Style="string"  
    TabIndex="integer"  
    ToolTip="string"  
    Visible="True|False"  
    Width="size"  
>  
        <AlternatingRowStyle />  
        <CommandRowStyle />  
        <EditRowStyle />  
        <EmptyDataRowStyle />  
        <EmptyDataTemplate>  
            <!-- child controls -->  
        </EmptyDataTemplate>  
        <FieldHeaderStyle />  
        <Fields>  
                <asp:BoundField  
                    AccessibleHeaderText="string"  
                    ApplyFormatInEditMode="True|False"  
                    ConvertEmptyStringToNull="True|False"  
                    DataField="string"  
                    DataFormatString="string"  
                    FooterText="string"  
                    HeaderImageUrl="uri"  
                    HeaderText="string"  
                    HtmlEncode="True|False"  
                    InsertVisible="True|False"  
                    NullDisplayText="string"  
                    ReadOnly="True|False"  
                    ShowHeader="True|False"  
                    SortExpression="string"  
                    Visible="True|False"  
>  
                        <ControlStyle />  
                        <FooterStyle />  
                        <HeaderStyle />  
                        <ItemStyle />  
                </asp:BoundField>  
                <asp:ButtonField  
                    AccessibleHeaderText="string"  
                    ButtonType="Button|Image|Link"  
                    CausesValidation="True|False"  
                    CommandName="string"  
                    DataTextField="string"  
                    DataTextFormatString="string"  
                    FooterText="string"  
                    HeaderImageUrl="uri"  
                    HeaderText="string"  
                    ImageUrl="uri"  
                    InsertVisible="True|False"  
                    ShowHeader="True|False"  
                    SortExpression="string"  
                    Text="string"  
                    ValidationGroup="string"  
                    Visible="True|False"  
>  
                        <ControlStyle />  
                        <FooterStyle />  
                        <HeaderStyle />  
                        <ItemStyle />  
                </asp:ButtonField>  
                <asp:CheckBoxField  
                    AccessibleHeaderText="string"  
                    DataField="string"  
                    FooterText="string"  
                    HeaderImageUrl="uri"  
                    HeaderText="string"  
                    InsertVisible="True|False"  
                    ReadOnly="True|False"  
                    ShowHeader="True|False"  
                    SortExpression="string"  
                    Text="string"  
                    Visible="True|False"  
>  
                        <ControlStyle />  
                        <FooterStyle />  
                        <HeaderStyle />  
                        <ItemStyle />  
                </asp:CheckBoxField>  
                <asp:CommandField  
                    AccessibleHeaderText="string"  
                    ButtonType="Button|Image|Link"  
                    CancelImageUrl="uri"  
                    CancelText="string"  
                    CausesValidation="True|False"  
                    DeleteImageUrl="uri"  
                    DeleteText="string"  
                    EditImageUrl="uri"  
                    EditText="string"  
                    FooterText="string"  
                    HeaderImageUrl="uri"  
                    HeaderText="string"  
                    InsertImageUrl="uri"  
                    InsertText="string"  
                    InsertVisible="True|False"  
                    NewImageUrl="uri"  
                    NewText="string"  
                    SelectImageUrl="uri"  
                    SelectText="string"  
                    ShowCancelButton="True|False"  
                    ShowDeleteButton="True|False"  
                    ShowEditButton="True|False"  
                    ShowHeader="True|False"  
                    ShowInsertButton="True|False"  
                    ShowSelectButton="True|False"  
                    SortExpression="string"  
                    UpdateImageUrl="uri"  
                    UpdateText="string"  
                    ValidationGroup="string"  
                    Visible="True|False"  
>  
                        <ControlStyle />  
                        <FooterStyle />  
                        <HeaderStyle />  
                        <ItemStyle />  
                </asp:CommandField>  
                <asp:DynamicField  
                    AccessibleHeaderText="string"  
                    ApplyFormatInEditMode="True|False"  
                    ConvertEmptyStringToNull="True|False"  
                    DataField="string"  
                    DataFormatString="string"  
                    FooterText="string"  
                    HeaderImageUrl="uri"  
                    HeaderText="string"  
                    HtmlEncode="True|False"  
                    InsertVisible="True|False"  
                    NullDisplayText="string"  
                    ShowHeader="True|False"  
                    UIHint="string"  
                    Visible="True|False"  
>  
                        <ControlStyle />  
                        <FooterStyle />  
                        <HeaderStyle />  
                        <ItemStyle />  
                </asp:DynamicField>  
                <asp:HyperLinkField  
                    AccessibleHeaderText="string"  
                    DataNavigateUrlFields="string"  
                    DataNavigateUrlFormatString="string"  
                    DataTextField="string"  
                    DataTextFormatString="string"  
                    FooterText="string"  
                    HeaderImageUrl="uri"  
                    HeaderText="string"  
                    InsertVisible="True|False"  
                    NavigateUrl="uri"  
                    ShowHeader="True|False"  
                    SortExpression="string"  
                    Target="string|_blank|_parent|_search|_self|_top"  
                    Text="string"  
                    Visible="True|False"  
>  
                        <ControlStyle />  
                        <FooterStyle />  
                        <HeaderStyle />  
                        <ItemStyle />  
                </asp:HyperLinkField>  
                <asp:ImageField  
                    AccessibleHeaderText="string"  
                    AlternateText="string"  
                    ConvertEmptyStringToNull="True|False"  
                    DataAlternateTextField="string"  
                    DataAlternateTextFormatString="string"  
                    DataImageUrlField="string"  
                    DataImageUrlFormatString="string"  
                    FooterText="string"  
                    HeaderImageUrl="uri"  
                    HeaderText="string"  
                    InsertVisible="True|False"  
                    NullDisplayText="string"  
                    NullImageUrl="uri"  
                    ReadOnly="True|False"  
                    ShowHeader="True|False"  
                    SortExpression="string"  
                    Visible="True|False"  
>  
                        <ControlStyle />  
                        <FooterStyle />  
                        <HeaderStyle />  
                        <ItemStyle />  
                </asp:ImageField>  
                <asp:TemplateField  
                    AccessibleHeaderText="string"  
                    ConvertEmptyStringToNull="True|False"  
                    FooterText="string"  
                    HeaderImageUrl="uri"  
                    HeaderText="string"  
                    InsertVisible="True|False"  
                    ShowHeader="True|False"  
                    SortExpression="string"  
                    Visible="True|False"  
>  
                            <ControlStyle />  
                            <FooterStyle />  
                            <HeaderStyle />  
                            <ItemStyle />  
                        <AlternatingItemTemplate>  
                            <!-- child controls -->  
                        </AlternatingItemTemplate>  
                        <EditItemTemplate>  
                            <!-- child controls -->  
                        </EditItemTemplate>  
                        <FooterTemplate>  
                            <!-- child controls -->  
                        </FooterTemplate>  
                        <HeaderTemplate>  
                            <!-- child controls -->  
                        </HeaderTemplate>  
                        <InsertItemTemplate>  
                            <!-- child controls -->  
                        </InsertItemTemplate>  
                        <ItemTemplate>  
                            <!-- child controls -->  
                        </ItemTemplate>  
                </asp:TemplateField>  
        </Fields>  
        <FooterStyle />  
        <FooterTemplate>  
            <!-- child controls -->  
        </FooterTemplate>  
        <HeaderStyle />  
        <HeaderTemplate>  
            <!-- child controls -->  
        </HeaderTemplate>  
        <InsertRowStyle />  
        <PagerSettings  
            FirstPageImageUrl="uri"  
            FirstPageText="string"  
            LastPageImageUrl="uri"  
            LastPageText="string"  
            Mode="NextPrevious|Numeric|NextPreviousFirstLast|  
                NumericFirstLast"  
            NextPageImageUrl="uri"  
            NextPageText="string"  
            OnPropertyChanged="PropertyChanged event handler"  
            PageButtonCount="integer"  
            Position="Bottom|Top|TopAndBottom"  
            PreviousPageImageUrl="uri"  
            PreviousPageText="string"  
            Visible="True|False"  
        />  
        <PagerStyle />  
        <PagerTemplate>  
            <!-- child controls -->  
        </PagerTemplate>  
        <RowStyle        />  
</asp:DetailsView>  

建構函式

DetailsView() DetailsView() DetailsView() DetailsView()

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

屬性

AccessKey AccessKey AccessKey AccessKey

取得或設定便捷鍵 (Access Key),可讓您快速巡覽至 Web 伺服器控制項。Gets or sets the access key that allows you to quickly navigate to the Web server control.

(Inherited from WebControl)
Adapter Adapter Adapter Adapter

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

(Inherited from Control)
AllowPaging AllowPaging AllowPaging AllowPaging

取得或設定值,指出是否啟用分頁功能。Gets or sets a value indicating whether the paging feature is enabled.

AlternatingRowStyle AlternatingRowStyle AlternatingRowStyle AlternatingRowStyle

取得 TableItemStyle 物件的參考,這個物件可讓您設定 DetailsView 控制項中替代資料列的外觀。Gets a reference to the TableItemStyle object that allows you to set the appearance of the alternating data rows in a DetailsView 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)
AutoGenerateDeleteButton AutoGenerateDeleteButton AutoGenerateDeleteButton AutoGenerateDeleteButton

取得或設定值,指出可刪除目前資料錄的內建控制項是否顯示於 DetailsView 控制項中。Gets or sets a value indicating whether the built-in control to delete the current record is displayed in a DetailsView control.

AutoGenerateEditButton AutoGenerateEditButton AutoGenerateEditButton AutoGenerateEditButton

取得或設定值,指出可編輯目前資料錄的內建控制項是否顯示於 DetailsView 控制項中。Gets or sets a value indicating whether the built-in controls to edit the current record are displayed in a DetailsView control.

AutoGenerateInsertButton AutoGenerateInsertButton AutoGenerateInsertButton AutoGenerateInsertButton

取得或設定值,指出可插入新資料錄的內建控制項是否顯示於 DetailsView 控制項中。Gets or sets a value indicating whether the built-in controls to insert a new record are displayed in a DetailsView control.

AutoGenerateRows AutoGenerateRows AutoGenerateRows AutoGenerateRows

取得或設定值,指出資料來源中每個欄位的資料列欄位是否會自動產生並顯示於 DetailsView 控制項中。Gets or sets a value indicating whether row fields for each field in the data source are automatically generated and displayed in a DetailsView control.

BackColor BackColor BackColor BackColor

取得或設定 Web 伺服器控制項的背景色彩。Gets or sets the background color of the Web server control.

(Inherited from WebControl)
BackImageUrl BackImageUrl BackImageUrl BackImageUrl

取得或設定要顯示於 DetailsView 控制項背景之影像的 URL。Gets or sets the URL to an image to display in the background of a DetailsView control.

BindingContainer BindingContainer BindingContainer BindingContainer

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

(Inherited from Control)
BorderColor BorderColor BorderColor BorderColor

取得或設定 Web 控制項的框線色彩。Gets or sets the border color of the Web control.

(Inherited from WebControl)
BorderStyle BorderStyle BorderStyle BorderStyle

取得或設定 Web 伺服器控制項的框線樣式。Gets or sets the border style of the Web server control.

(Inherited from WebControl)
BorderWidth BorderWidth BorderWidth BorderWidth

取得或設定 Web 伺服器控制項的框線寬度。Gets or sets the border width of the Web server control.

(Inherited from WebControl)
BottomPagerRow BottomPagerRow BottomPagerRow BottomPagerRow

取得 DetailsViewRow 物件,其表示 DetailsView 控制項中的底端頁面巡覽列。Gets a DetailsViewRow object that represents the bottom pager row in a DetailsView control.

Caption Caption Caption Caption

取得或設定要在 DetailsView 控制項之 HTML 標題項目中呈現的文字。Gets or sets the text to render in an HTML caption element in a DetailsView control. 這個屬性可讓協助技術裝置的使用者更容易存取控制項。This property is provided to make the control more accessible to users of assistive technology devices.

CaptionAlign CaptionAlign CaptionAlign CaptionAlign

取得或設定 DetailsView 控制項中 HTML 標題項目的水平或垂直位置。Gets or sets the horizontal or vertical position of the HTML caption element in a DetailsView control. 這個屬性可讓協助技術裝置的使用者更容易存取控制項。This property is provided to make the control more accessible to users of assistive technology devices.

CellPadding CellPadding CellPadding CellPadding

取得或設定儲存格內容和其框線之間的間距。Gets or sets the amount of space between the contents of a cell and the cell's border.

CellSpacing CellSpacing CellSpacing CellSpacing

取得或設定儲存格之間的間距。Gets or sets the amount of space between cells.

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)
ClientIDSeparator ClientIDSeparator ClientIDSeparator ClientIDSeparator

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

(Inherited from Control)
CommandRowStyle CommandRowStyle CommandRowStyle CommandRowStyle

取得 TableItemStyle 物件的參考,這個物件可讓您設定 DetailsView 控制項中命令資料列的外觀。Gets a reference to the TableItemStyle object that allows you to set the appearance of a command row in a DetailsView 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

取得複合資料繫結控制項內之子控制項的集合。Gets a collection of the child controls within the composite data-bound control.

(Inherited from CompositeDataBoundControl)
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)
CssClass CssClass CssClass CssClass

取得或設定用戶端上 Web 伺服器控制項所呈現的階層式樣式表 (CSS)。Gets or sets the Cascading Style Sheet (CSS) class rendered by the Web server control on the client.

(Inherited from WebControl)
CurrentMode CurrentMode CurrentMode CurrentMode

取得 DetailsView 控制項目前的資料輸入模式。Gets the current data-entry mode of the DetailsView control.

DataItem DataItem DataItem DataItem

取得繫結至 DetailsView 控制項的資料項目。Gets the data item bound to the DetailsView control.

DataItemContainer DataItemContainer DataItemContainer DataItemContainer

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

(Inherited from Control)
DataItemCount DataItemCount DataItemCount DataItemCount

取得基礎資料來源中的項目數目。Gets the number of items in the underlying data source.

DataItemIndex DataItemIndex DataItemIndex DataItemIndex

取得項目的索引,此項目來自基礎資料來源,目前顯示在 DetailsView 控制項中。Gets the index of the item being displayed in a DetailsView control from the underlying data source.

DataKey DataKey DataKey DataKey

取得 DataKey 物件,表示所顯示資料錄的主索引鍵。Gets a DataKey object that represents the primary key of the displayed record.

DataKeyNames DataKeyNames DataKeyNames DataKeyNames

取得或設定陣列,陣列中包含資料來源的索引鍵欄位名稱。Gets or sets an array that contains the names of the key fields for the data source.

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)
DefaultMode DefaultMode DefaultMode DefaultMode

取得或設定 DetailsView 控制項的預設資料輸入模式。Get or sets the default data-entry mode of the DetailsView control.

DeleteMethod DeleteMethod DeleteMethod DeleteMethod

取得或設定在頁面上控制項執行刪除作業時所呼叫的方法名稱。Gets or sets the name of the method on the page that is called when the control performs a delete operation.

DesignMode DesignMode DesignMode DesignMode

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

(Inherited from Control)
EditRowStyle EditRowStyle EditRowStyle EditRowStyle

取得 TableItemStyle 物件的參考,這個物件可以讓您設定當 DetailsView 控制項處於編輯模式時的資料列外觀。Gets a reference to the TableItemStyle object that allows you to set the appearance of the data rows when a DetailsView control is in edit mode.

EmptyDataRowStyle EmptyDataRowStyle EmptyDataRowStyle EmptyDataRowStyle

取得 TableItemStyle 物件的參考,可以讓您設定當繫結至 DetailsView 控制項的資料來源不含任何資料錄時,顯示之空白資料列的外觀。Gets a reference to the TableItemStyle object that allows you to set the appearance of the empty data row displayed when the data source bound to a DetailsView control does not contain any records.

EmptyDataTemplate EmptyDataTemplate EmptyDataTemplate EmptyDataTemplate

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

EmptyDataText EmptyDataText EmptyDataText EmptyDataText

取得或設定空白資料列中顯示的文字,該資料列呈現於 DetailsView 控制項繫結至不包含任何資料錄的資料來源時。Gets or sets the text to display in the empty data row rendered when a DetailsView control is bound to a data source that does not contain any records.

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 data-model validation is enabled.

EnablePagingCallbacks EnablePagingCallbacks EnablePagingCallbacks EnablePagingCallbacks

取得或設定值,指出是否在 DetailsView 控制項的分頁作業中使用用戶端回呼函式 (Callback Function)。Gets or sets a value indicating whether client-side callback functions are used for paging operations in the DetailsView 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)
FieldHeaderStyle FieldHeaderStyle FieldHeaderStyle FieldHeaderStyle

取得 TableItemStyle 物件的參考,這個物件可讓您設定 DetailsView 控制項中標頭資料行的外觀。Gets a reference to the TableItemStyle object that allows you to set the appearance of the header column in a DetailsView control.

Fields Fields Fields Fields

取得 DataControlField 物件的集合,表示 DetailsView 控制項中明確宣告的資料列欄位。Gets a collection of DataControlField objects that represent the explicitly declared row fields in a DetailsView control.

Font Font Font Font

取得與 Web 伺服器控制項關聯的字型屬性。Gets the font properties associated with the Web server control.

(Inherited from WebControl)
FooterRow FooterRow FooterRow FooterRow

取得 DetailsViewRow 物件,其表示 DetailsView 控制項中的頁尾資料列。Gets a DetailsViewRow object that represents the footer row in a DetailsView control.

FooterStyle FooterStyle FooterStyle FooterStyle

取得 TableItemStyle 物件的參考,可以讓您設定 DetailsView 控制項中頁尾資料列的外觀。Gets a reference to the TableItemStyle object that allows you to set the appearance of the footer row in a DetailsView control.

FooterTemplate FooterTemplate FooterTemplate FooterTemplate

取得或設定 DetailsView 控制項中,頁尾資料列的使用者定義內容。Gets or sets the user-defined content for the footer row in a DetailsView control.

FooterText FooterText FooterText FooterText

取得或設定顯示於 DetailsView 控制項頁尾資料列的文字。Gets or sets the text to display in the footer row of a DetailsView control.

ForeColor ForeColor ForeColor ForeColor

取得或設定 Web 伺服器控制項的前景色彩 (通常是文字的色彩)。Gets or sets the foreground color (typically the color of the text) of the Web server control.

(Inherited from WebControl)
GridLines GridLines GridLines GridLines

取得或設定 DetailsView 控制項的格線樣式。Gets or sets the gridline style for a DetailsView 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)
HeaderRow HeaderRow HeaderRow HeaderRow

取得 DetailsViewRow 物件,表示 DetailsView 控制項中的標頭資料列。Gets a DetailsViewRow object that represents the header row in a DetailsView control.

HeaderStyle HeaderStyle HeaderStyle HeaderStyle

取得 TableItemStyle 物件的參考,可以讓您設定 DetailsView 控制項中頁首資料列的外觀。Gets a reference to the TableItemStyle object that allows you to set the appearance of the header row in a DetailsView control.

HeaderTemplate HeaderTemplate HeaderTemplate HeaderTemplate

取得或設定 DetailsView 控制項中,標頭資料列的使用者定義內容。Gets or sets the user-defined content for the header row in a DetailsView control.

HeaderText HeaderText HeaderText HeaderText

取得或設定顯示於 DetailsView 控制項中頁首資料列的文字。Gets or sets the text to display in the header row of a DetailsView control.

Height Height Height Height

取得或設定 Web 伺服器控制項的高度。Gets or sets the height of the Web server control.

(Inherited from WebControl)
HorizontalAlign HorizontalAlign HorizontalAlign HorizontalAlign

取得或設定頁面上 DetailsView 控制項的水平對齊。Gets or sets the horizontal alignment of a DetailsView control on the page.

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)
InsertMethod InsertMethod InsertMethod InsertMethod

取得或設定在頁面上控制項執行插入作業時所呼叫的方法名稱。Gets or sets the name of the method on the page that is called when the control performs an insert operation.

InsertRowStyle InsertRowStyle InsertRowStyle InsertRowStyle

取得 TableItemStyle 物件的參考,這個物件可讓您在 DetailsView 控制項處於插入模式時,設定 DetailsView 控制項中資料列的外觀。Gets a reference to the TableItemStyle object that allows you to set the appearance of the data rows in a DetailsView control when the DetailsView control is in insert mode.

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.

(Inherited from CompositeDataBoundControl)
IsViewStateEnabled IsViewStateEnabled IsViewStateEnabled IsViewStateEnabled

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

(Inherited from Control)
ItemType ItemType ItemType ItemType

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

(Inherited from DataBoundControl)
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)
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)
PageCount PageCount PageCount PageCount

取得資料來源中的資料錄數目。Gets the number of records in the data source.

PageIndex PageIndex PageIndex PageIndex

取得或設定顯示資料錄的索引。Gets or sets the index of the displayed record.

PagerSettings PagerSettings PagerSettings PagerSettings

取得 PagerSettings 物件的參考,可以讓您設定 DetailsView 控制項中頁面巡覽區按鈕的屬性。Gets a reference to the PagerSettings object that allows you to set the properties of the pager buttons in a DetailsView control.

PagerStyle PagerStyle PagerStyle PagerStyle

取得 TableItemStyle 物件的參考,可以讓您設定 DetailsView 控制項中頁面巡覽列的外觀。Gets a reference to the TableItemStyle object that allows you to set the appearance of the pager row in a DetailsView control.

PagerTemplate PagerTemplate PagerTemplate PagerTemplate

取得或設定 DetailsView 控制項中頁面巡覽列的自訂內容。Gets or sets the custom content for the pager row in a DetailsView 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)
Rows Rows Rows Rows

取得 DetailsViewRow 物件的集合,其表示 DetailsView 控制項中的資料列。Gets a collection of DetailsViewRow objects that represent the data rows in a DetailsView control.

RowsGenerator RowsGenerator RowsGenerator RowsGenerator

取得或設定物件,這個物件會實作 IAutoFieldGenerator 介面,以便在檢視中自動填入資料列。Gets or sets an object that implements the IAutoFieldGenerator interface in order to automatically populate rows in the view.

RowStyle RowStyle RowStyle RowStyle

取得 TableItemStyle 物件的參考,這個物件可讓您設定 DetailsView 控制項中資料列的外觀。Gets a reference to the TableItemStyle object that allows you to set the appearance of the data rows in a DetailsView control.

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)
SelectedValue SelectedValue SelectedValue SelectedValue

取得 DetailsView 控制項中目前資料錄的資料索引鍵值。Gets the data key value of the current record in a DetailsView 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)
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

取得或設定 Web 伺服器控制項的定位索引。Gets or sets the tab index of the Web server control.

(Inherited from WebControl)
TagKey TagKey TagKey TagKey

取得 DetailsView 控制項的 HtmlTextWriterTag 值。Gets the HtmlTextWriterTag value for the DetailsView control.

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

取得或設定當滑鼠指標停留在 Web 伺服器控制項時顯示的文字。Gets or sets the text displayed when the mouse pointer hovers over the Web server control.

(Inherited from WebControl)
TopPagerRow TopPagerRow TopPagerRow TopPagerRow

取得 DetailsViewRow 物件,其表示 DetailsView 控制項中的頂端頁面巡覽列。Gets a DetailsViewRow object that represents the top pager row in a DetailsView 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 on the page that is called when the control performs an update operation.

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

取得或設定 Web 伺服器控制項的寬度。Gets or sets the width of the Web server control.

(Inherited from WebControl)

方法

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)
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)
ChangeMode(DetailsViewMode) ChangeMode(DetailsViewMode) ChangeMode(DetailsViewMode) ChangeMode(DetailsViewMode)

DetailsView 控制項切換為指定的模式。Switches the DetailsView control to the specified mode.

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)
CreateAutoGeneratedRow(AutoGeneratedFieldProperties) CreateAutoGeneratedRow(AutoGeneratedFieldProperties) CreateAutoGeneratedRow(AutoGeneratedFieldProperties) CreateAutoGeneratedRow(AutoGeneratedFieldProperties)

使用指定的欄位屬性,建立表示自動產生資料列欄位的 AutoGeneratedField 物件。Creates an AutoGeneratedField object that represents an automatically generated row field using the specified field properties.

CreateAutoGeneratedRows(Object) CreateAutoGeneratedRows(Object) CreateAutoGeneratedRows(Object) CreateAutoGeneratedRows(Object)

針對指定的資料項目,建立一組自動產生的資料列欄位。Creates a set of automatically generated row fields for the specified data item.

CreateChildControls() CreateChildControls() CreateChildControls() CreateChildControls()

根據儲存在檢視狀態中的值,建立用來呈現複合資料繫結控制項的控制項階層架構。Creates the control hierarchy that is used to render a composite data-bound control based on the values that are stored in view state.

(Inherited from CompositeDataBoundControl)
CreateChildControls(IEnumerable, Boolean) CreateChildControls(IEnumerable, Boolean) CreateChildControls(IEnumerable, Boolean) CreateChildControls(IEnumerable, Boolean)

建立用來呈現 DetailsView 控制項的控制階層架構。Creates the control hierarchy used to render the DetailsView control.

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()

建立 DetailsView 控制項的預設資料表樣式物件。Creates a default table style object for the DetailsView control.

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

建立傳遞至 Select 命令的 DataSourceSelectArguments 物件。Creates the DataSourceSelectArguments object that gets passed to the Select command.

CreateFieldSet(Object, Boolean) CreateFieldSet(Object, Boolean) CreateFieldSet(Object, Boolean) CreateFieldSet(Object, Boolean)

建立自動產生與使用者定義資料列欄位的完整集合,以便用來產生控制階層架構。Creates the complete set of automatically generated and user-defined row fields used to generate the control hierarchy.

CreateRow(Int32, DataControlRowType, DataControlRowState) CreateRow(Int32, DataControlRowType, DataControlRowState) CreateRow(Int32, DataControlRowType, DataControlRowState) CreateRow(Int32, DataControlRowType, DataControlRowState)

建立使用指定項目索引、資料列型別和資料列狀態的 DetailsViewRow 物件。Creates a DetailsViewRow object using the specified item index, row type, and row state.

CreateTable() CreateTable() CreateTable() CreateTable()

建立 DetailsView 控制項的包含資料表。Creates the containing table for the DetailsView control.

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

呼叫基底類別的 DataBind() 方法。Calls the DataBind() method of the base class.

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() DeleteItem() DeleteItem() DeleteItem()

將目前的資料錄從資料來源中刪除。Deletes the current record 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() 方法。Calls the DataBind() method after verifying that the data listing control requires data binding and that a valid data source control is specified.

EnsureID() EnsureID() EnsureID() EnsureID()

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

(Inherited from Control)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
ExtractRowValues(IOrderedDictionary, Boolean, Boolean) ExtractRowValues(IOrderedDictionary, Boolean, Boolean) ExtractRowValues(IOrderedDictionary, Boolean, Boolean) ExtractRowValues(IOrderedDictionary, Boolean, Boolean)

擷取每個顯示欄位的值,並將它們儲存在指定的 IOrderedDictionary 物件中。Retrieves the values of each field displayed 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)
Focus() Focus() Focus() Focus()

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

(Inherited from Control)
GetCallbackResult() GetCallbackResult() GetCallbackResult() GetCallbackResult()

傳回以控制項為目標之回呼事件的結果。Returns the result of a callback event that targets a control.

GetCallbackScript(IButtonControl, String) GetCallbackScript(IButtonControl, String) GetCallbackScript(IButtonControl, String) GetCallbackScript(IButtonControl, String)

使用指定的引數,傳回建立的回呼字串。Returns the callback string created using the specified argument.

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)
InitializePager(DetailsViewRow, PagedDataSource) InitializePager(DetailsViewRow, PagedDataSource) InitializePager(DetailsViewRow, PagedDataSource) InitializePager(DetailsViewRow, PagedDataSource)

建立 DetailsView 控制項的頁面巡覽列。Creates the pager row for the DetailsView control.

InitializeRow(DetailsViewRow, DataControlField) InitializeRow(DetailsViewRow, DataControlField) InitializeRow(DetailsViewRow, DataControlField) InitializeRow(DetailsViewRow, DataControlField)

初始化指定的 DetailsViewRow 物件。Initializes the specified DetailsViewRow object.

InsertItem(Boolean) InsertItem(Boolean) InsertItem(Boolean) InsertItem(Boolean)

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

IsBindableType(Type) IsBindableType(Type) IsBindableType(Type) IsBindableType(Type)

判斷指定的資料型別是否可以繫結至 DetailsView 控制項中的欄位。Determines whether the specified data type can be bound to a field in the DetailsView control.

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

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

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

載入需要保存之 DetailsView 控制項中屬性的狀態,即使 EnableViewState 屬性設為 falseLoads the state of the properties in the DetailsView control that need to be persisted, even when the EnableViewState property is set to false.

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

載入先前儲存的 DetailsView 控制項檢視狀態。Loads the previously saved view state of the DetailsView 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)

決定 Web 伺服器控制項的事件是否要向上傳遞至網頁的使用者介面 (UI) 伺服器控制階層架構。Determines whether the event for the Web server control is passed up the page's user interface (UI) server control hierarchy.

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.

OnInit(EventArgs) OnInit(EventArgs) OnInit(EventArgs) OnInit(EventArgs)

引發 Init 事件。Raises the Init event.

OnItemCommand(DetailsViewCommandEventArgs) OnItemCommand(DetailsViewCommandEventArgs) OnItemCommand(DetailsViewCommandEventArgs) OnItemCommand(DetailsViewCommandEventArgs)

引發 ItemCommand 事件。Raises the ItemCommand event.

OnItemCreated(EventArgs) OnItemCreated(EventArgs) OnItemCreated(EventArgs) OnItemCreated(EventArgs)

引發 ItemCreated 事件。Raises the ItemCreated event.

OnItemDeleted(DetailsViewDeletedEventArgs) OnItemDeleted(DetailsViewDeletedEventArgs) OnItemDeleted(DetailsViewDeletedEventArgs) OnItemDeleted(DetailsViewDeletedEventArgs)

引發 ItemDeleted 事件。Raises the ItemDeleted event.

OnItemDeleting(DetailsViewDeleteEventArgs) OnItemDeleting(DetailsViewDeleteEventArgs) OnItemDeleting(DetailsViewDeleteEventArgs) OnItemDeleting(DetailsViewDeleteEventArgs)

引發 ItemDeleting 事件。Raises the ItemDeleting event.

OnItemInserted(DetailsViewInsertedEventArgs) OnItemInserted(DetailsViewInsertedEventArgs) OnItemInserted(DetailsViewInsertedEventArgs) OnItemInserted(DetailsViewInsertedEventArgs)

引發 ItemInserted 事件。Raises the ItemInserted event.

OnItemInserting(DetailsViewInsertEventArgs) OnItemInserting(DetailsViewInsertEventArgs) OnItemInserting(DetailsViewInsertEventArgs) OnItemInserting(DetailsViewInsertEventArgs)

引發 ItemInserting 事件。Raises the ItemInserting event.

OnItemUpdated(DetailsViewUpdatedEventArgs) OnItemUpdated(DetailsViewUpdatedEventArgs) OnItemUpdated(DetailsViewUpdatedEventArgs) OnItemUpdated(DetailsViewUpdatedEventArgs)

引發 ItemUpdated 事件。Raises the ItemUpdated event.

OnItemUpdating(DetailsViewUpdateEventArgs) OnItemUpdating(DetailsViewUpdateEventArgs) OnItemUpdating(DetailsViewUpdateEventArgs) OnItemUpdating(DetailsViewUpdateEventArgs)

引發 ItemUpdating 事件。Raises the ItemUpdating event.

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

處理 Load 事件。Handles the Load event.

(Inherited from DataBoundControl)
OnModeChanged(EventArgs) OnModeChanged(EventArgs) OnModeChanged(EventArgs) OnModeChanged(EventArgs)

引發 ModeChanged 事件。Raises the ModeChanged event.

OnModeChanging(DetailsViewModeEventArgs) OnModeChanging(DetailsViewModeEventArgs) OnModeChanging(DetailsViewModeEventArgs) OnModeChanging(DetailsViewModeEventArgs)

引發 ModeChanging 事件。Raises the ModeChanging event.

OnPageIndexChanged(EventArgs) OnPageIndexChanged(EventArgs) OnPageIndexChanged(EventArgs) OnPageIndexChanged(EventArgs)

引發 PageIndexChanged 事件。Raises the PageIndexChanged event.

OnPageIndexChanging(DetailsViewPageEventArgs) OnPageIndexChanging(DetailsViewPageEventArgs) OnPageIndexChanging(DetailsViewPageEventArgs) OnPageIndexChanging(DetailsViewPageEventArgs)

引發 PageIndexChanging 事件。Raises the PageIndexChanging event.

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.

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

引發 PreRender 事件。Raises the PreRender 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)

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

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

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

(Inherited from DataBoundControl)
PrepareControlHierarchy() PrepareControlHierarchy() PrepareControlHierarchy() PrepareControlHierarchy()

設定 DetailsView 控制項的控制階層架構。Sets up the control hierarchy of the DetailsView control.

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)
RaiseCallbackEvent(String) RaiseCallbackEvent(String) RaiseCallbackEvent(String) RaiseCallbackEvent(String)

建立 GetCallbackEventReference 方法中回呼處理常式的引數。Creates the arguments for the callback handler in the GetCallbackEventReference method.

RaisePostBackEvent(String) RaisePostBackEvent(String) RaisePostBackEvent(String) RaisePostBackEvent(String)

回傳至伺服器時引發 DetailsView 控制項的適當事件。Raises the appropriate events for the DetailsView control when it posts back to the server.

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)
Render(HtmlTextWriter) Render(HtmlTextWriter) Render(HtmlTextWriter) Render(HtmlTextWriter)

使用指定的 DetailsView 物件,在用戶端上顯示 HtmlTextWriter 控制項。Displays the DetailsView control on the client 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()

儲存需要保存之 DetailsView 控制項中屬性的狀態,即使 EnableViewState 屬性設為 falseSaves the state of the properties in the DetailsView control that need to be persisted, even when the EnableViewState property is set to false.

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

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

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

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

(Inherited from Control)
SetPageIndex(Int32) SetPageIndex(Int32) SetPageIndex(Int32) SetPageIndex(Int32)

設定目前顯示於 DetailsView 控制項中之頁面的索引。Sets the index of the currently displayed page in the DetailsView 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)
ToString() ToString() ToString() ToString()

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

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

標記起點,從此點開始追蹤並儲存 DetailsView 控制項的檢視狀態變更。Marks the starting point to begin tracking and saving view-state changes to the DetailsView control.

UpdateItem(Boolean) UpdateItem(Boolean) UpdateItem(Boolean) UpdateItem(Boolean)

更新資料來源中目前的資料錄。Updates the current record 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)
ItemCommand ItemCommand ItemCommand ItemCommand

按一下 DetailsView 控制項中的按鈕時會發生這個事件。Occurs when a button within a DetailsView control is clicked.

ItemCreated ItemCreated ItemCreated ItemCreated

DetailsView 控制項中建立記錄時會發生這個事件。Occurs when a record is created in a DetailsView control.

ItemDeleted ItemDeleted ItemDeleted ItemDeleted

發生於按一下 DetailsView 控制項內的 [刪除] 按鈕時,但是在刪除作業之後。Occurs when a Delete button within a DetailsView control is clicked, but after the delete operation.

ItemDeleting ItemDeleting ItemDeleting ItemDeleting

發生於按一下 DetailsView 控制項內的 [刪除] 按鈕時,但是在刪除作業之前。Occurs when a Delete button within a DetailsView control is clicked, but before the delete operation.

ItemInserted ItemInserted ItemInserted ItemInserted

發生於按一下 DetailsView 控制項內的 [插入] 按鈕時,但是在插入作業之後。Occurs when an Insert button within a DetailsView control is clicked, but after the insert operation.

ItemInserting ItemInserting ItemInserting ItemInserting

發生於按一下 DetailsView 控制項內的 [插入] 按鈕,但是在插入作業之前。Occurs when an Insert button within a DetailsView control is clicked, but before the insert operation.

ItemUpdated ItemUpdated ItemUpdated ItemUpdated

發生於按一下 DetailsView 控制項內的 [更新] 按鈕時,但在更新作業之後。Occurs when an Update button within a DetailsView control is clicked, but after the update operation.

ItemUpdating ItemUpdating ItemUpdating ItemUpdating

發生於按一下 DetailsView 控制項內的 [更新] 按鈕時,但在更新作業之前。Occurs when an Update button within a DetailsView control is clicked, but before the update operation.

Load Load Load Load

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

(Inherited from Control)
ModeChanged ModeChanged ModeChanged ModeChanged

發生於 DetailsView 控制項嘗試在編輯、插入和唯讀模式之間變更,但是在 CurrentMode 屬性更新之後。Occurs when a DetailsView control attempts to change between edit, insert, and read-only mode, but after the CurrentMode property is updated.

ModeChanging ModeChanging ModeChanging ModeChanging

發生於 DetailsView 控制項嘗試在編輯、插入和唯讀模式之間變更,但是在 CurrentMode 屬性更新之前。Occurs when a DetailsView control attempts to change between edit, insert, and read-only mode, but before the CurrentMode property is updated.

PageIndexChanged PageIndexChanged PageIndexChanged PageIndexChanged

發生於 PageIndex 屬性值在分頁作業之後變更時。Occurs when the value of the PageIndex property changes after a paging operation.

PageIndexChanging PageIndexChanging PageIndexChanging PageIndexChanging

發生於 PageIndex 屬性值在分頁作業前變更時。Occurs when the value of the PageIndex property changes before a paging operation.

PreRender PreRender PreRender PreRender

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

(Inherited from Control)
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)
ICallbackContainer.GetCallbackScript(IButtonControl, String) ICallbackContainer.GetCallbackScript(IButtonControl, String) ICallbackContainer.GetCallbackScript(IButtonControl, String) ICallbackContainer.GetCallbackScript(IButtonControl, String)

建立 DetailsView 控制項的回呼指令碼。Creates the callback script for the DetailsView control.

ICallbackEventHandler.GetCallbackResult() ICallbackEventHandler.GetCallbackResult() ICallbackEventHandler.GetCallbackResult() ICallbackEventHandler.GetCallbackResult()

請參閱 GetCallbackResult() 方法。See the method GetCallbackResult().

ICallbackEventHandler.RaiseCallbackEvent(String) ICallbackEventHandler.RaiseCallbackEvent(String) ICallbackEventHandler.RaiseCallbackEvent(String) ICallbackEventHandler.RaiseCallbackEvent(String)

使用指定的引數引發回呼事件。Raises the callback event using the specified arguments.

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

如需這個屬性的說明,請參閱 DataKeyNamesFor a description of this property, see DataKeyNames.

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

如需這個屬性的說明,請參閱 DataMemberFor a description of this property, see DataMember.

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

如需這個屬性的說明,請參閱 DataSourceFor a description of this property, see DataSource.

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

如需這個屬性的說明,請參閱 DataSourceIDFor a description of this property, see DataSourceID.

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

如需這個屬性的說明,請參閱 DataSourceObjectFor a description of this property, see DataSourceObject.

IDataBoundItemControl.DataKey IDataBoundItemControl.DataKey IDataBoundItemControl.DataKey IDataBoundItemControl.DataKey

如需這個屬性的說明,請參閱 DataKeyFor a description of this property, see DataKey.

IDataBoundItemControl.Mode IDataBoundItemControl.Mode IDataBoundItemControl.Mode IDataBoundItemControl.Mode

如需這個屬性的說明,請參閱 ModeFor a description of this property, see Mode.

IDataItemContainer.DataItemIndex IDataItemContainer.DataItemIndex IDataItemContainer.DataItemIndex IDataItemContainer.DataItemIndex

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

IDataItemContainer.DisplayIndex IDataItemContainer.DisplayIndex IDataItemContainer.DisplayIndex IDataItemContainer.DisplayIndex

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

IFieldControl.FieldsGenerator IFieldControl.FieldsGenerator IFieldControl.FieldsGenerator IFieldControl.FieldsGenerator

如需這個屬性的說明,請參閱 FieldsGeneratorFor a description of this property, see FieldsGenerator.

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)
IPostBackContainer.GetPostBackOptions(IButtonControl) IPostBackContainer.GetPostBackOptions(IButtonControl) IPostBackContainer.GetPostBackOptions(IButtonControl) IPostBackContainer.GetPostBackOptions(IButtonControl)

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

IPostBackEventHandler.RaisePostBackEvent(String) IPostBackEventHandler.RaisePostBackEvent(String) IPostBackEventHandler.RaisePostBackEvent(String) IPostBackEventHandler.RaisePostBackEvent(String)

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

擴充方法

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.

適用於

另請參閱