FormView FormView FormView FormView Class

定義

利用使用者定義的樣板,顯示資料來源中單一資料錄的值。Displays the values of a single record from a data source using user-defined templates. FormView 控制項可讓您編輯、刪除及插入記錄。The FormView control allows you to edit, delete, and insert records.

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

範例

下列範例示範如何使用FormView控制項來顯示SqlDataSource控制項中的值。The following example demonstrates how to use a FormView control to display the values from a SqlDataSource control.


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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>FormView Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>FormView Example</h3>
                       
      <asp:formview id="EmployeeFormView"
        datasourceid="EmployeeSource"
        allowpaging="true"
        datakeynames="EmployeeID" 
        runat="server">
        
        <itemtemplate>
        
          <table>
            <tr>
              <td>
                <asp:image id="EmployeeImage"
                  imageurl='<%# Eval("PhotoPath") %>'
                  alternatetext='<%# Eval("LastName") %>' 
                  runat="server"/>
              </td>
              <td>
                <h3><%# Eval("FirstName") %>&nbsp;<%# Eval("LastName") %></h3>      
                <%# Eval("Title") %>        
              </td>
            </tr>
          </table>
        
        </itemtemplate>
          
        <pagersettings position="Bottom"
          mode="NextPrevious"/> 
                  
      </asp:formview>
          
      <!-- This example uses Microsoft SQL Server and connects  -->
      <!-- to the Northwind sample database. Use an ASP.NET     -->
      <!-- expression to retrieve the connection string value   -->
      <!-- from the Web.config file.                            -->
      <asp:sqldatasource id="EmployeeSource"
        selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title], [PhotoPath] From [Employees]"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" 
        runat="server"/>
            
    </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>FormView Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>FormView Example</h3>
                       
      <asp:formview id="EmployeeFormView"
        datasourceid="EmployeeSource"
        allowpaging="true"
        datakeynames="EmployeeID" 
        runat="server">
        
        <itemtemplate>
        
          <table>
            <tr>
              <td>
                <asp:image id="EmployeeImage"
                  imageurl='<%# Eval("PhotoPath") %>'
                  alternatetext='<%# Eval("LastName") %>' 
                  runat="server"/>
              </td>
              <td>
                <h3><%# Eval("FirstName") %>&nbsp;<%# Eval("LastName") %></h3>      
                <%# Eval("Title") %>        
              </td>
            </tr>
          </table>
        
        </itemtemplate>
          
        <pagersettings position="Bottom"
          mode="NextPrevious"/> 
                  
      </asp:formview>
          
      <!-- This example uses Microsoft SQL Server and connects  -->
      <!-- to the Northwind sample database. Use an ASP.NET     -->
      <!-- expression to retrieve the connection string value   -->
      <!-- from the Web.config file.                            -->
      <asp:sqldatasource id="EmployeeSource"
        selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title], [PhotoPath] From [Employees]"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" 
        runat="server"/>
            
    </form>
  </body>
</html>

下列範例示範如何使用FormView控制項來編輯現有的記錄。The following example demonstrates how to use a FormView control to edit existing records.

重要

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


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

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

  void EmployeeFormView_ItemUpdating(Object sender, FormViewUpdateEventArgs e)
  {

    // Validate the field values entered by the user. This
    // example determines whether the user left any fields
    // empty. Use the NewValues property to access the new 
    // values entered by the user.
    ArrayList emptyFieldList = ValidateFields(e.NewValues);

    if (emptyFieldList.Count > 0)
    {

      // The user left some fields empty. Display an error message.
      
      // Use the Keys property to retrieve the key field value.
      String keyValue = e.Keys["EmployeeID"].ToString();

      MessageLabel.Text = "You must enter a value for each field of record " +
        keyValue + ".<br/>The following fields are missing:<br/><br/>";

      // Display the missing fields.
      foreach (String value in emptyFieldList)
      {
        // Use the OldValues property to access the original value
        // of a field.
        MessageLabel.Text += value + " - Original Value = " + 
          e.OldValues[value].ToString() + "<br />";
      }

      // Cancel the update operation.
      e.Cancel = true;

    }
    else
    {
      // The field values passed validation. Clear the
      // error message label.
      MessageLabel.Text = "";
    }

  }

  ArrayList ValidateFields(IOrderedDictionary list)
  {
    
    // Create an ArrayList object to store the
    // names of any empty fields.
    ArrayList emptyFieldList = new ArrayList();

    // Iterate though the field values entered by
    // the user and check for an empty field. Empty
    // fields contain a null value.
    foreach (DictionaryEntry entry in list)
    {
      if (entry.Value == String.Empty)
      {
        // Add the field name to the ArrayList object.
        emptyFieldList.Add(entry.Key.ToString());
      }
    }

    return emptyFieldList;
  }

  void EmployeeFormView_ModeChanging(Object sender, FormViewModeEventArgs e)
  {
    if (e.CancelingEdit)
    {
      // The user canceled the update operation.
      // Clear the error message label.
      MessageLabel.Text = "";
    }
  }

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>FormView Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>FormView Example</h3>
                       
      <asp:formview id="EmployeeFormView"
        datasourceid="EmployeeSource"
        allowpaging="true"
        datakeynames="EmployeeID"
        headertext="Employee Record"
        emptydatatext="No employees found."
        onitemupdating="EmployeeFormView_ItemUpdating"
        onmodechanging="EmployeeFormView_ModeChanging"  
        runat="server">
        
        <headerstyle backcolor="CornFlowerBlue"
          forecolor="White"
          font-size="14"
          horizontalalign="Center"  
          wrap="false"/>
        <rowstyle backcolor="LightBlue"
          wrap="false"/>
        <pagerstyle backcolor="CornFlowerBlue"/>

        <itemtemplate>
          <table>
            <tr>
              <td rowspan="6">
                <asp:image id="EmployeeImage"
                  imageurl='<%# Eval("PhotoPath") %>'
                  alternatetext='<%# Eval("LastName") %>' 
                  runat="server"/>
              </td>
              <td colspan="2">
                  &nbsp; 
              </td>
            </tr>
            <tr>
              <td>
                <b>Name:</b>
              </td>
              <td>
                <%# Eval("FirstName") %> <%# Eval("LastName") %>
              </td>
            </tr>
            <tr>
              <td>
                <b>Title:</b>
              </td>
              <td>
                <%# Eval("Title") %>
              </td>
            </tr>
            <tr>
              <td>
                <b>Hire Date:</b>                 
              </td>
              <td>
                <%# Eval("HireDate","{0:d}") %>
              </td>
            </tr>
            <tr style="height:150; vertical-align:top">
              <td>
                <b>Address:</b>
              </td>
              <td>
                <%# Eval("Address") %><br/>
                <%# Eval("City") %> <%# Eval("Region") %>
                <%# Eval("PostalCode") %><br/>
                <%# Eval("Country") %>   
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <asp:linkbutton id="Edit"
                  text="Edit"
                  commandname="Edit"
                  runat="server"/> 
              </td>
            </tr>
          </table>       
        </itemtemplate>
        <edititemtemplate>
          <table>
            <tr>
              <td rowspan="6">
                <asp:image id="EmployeeEditImage"
                  imageurl='<%# Eval("PhotoPath") %>'
                  alternatetext='<%# Eval("LastName") %>' 
                  runat="server"/>
              </td>
              <td colspan="2">
                  &nbsp; 
              </td>
            </tr>
            <tr>
              <td>
                <b>Name:</b>
              </td>
              <td>
                <asp:textbox id="FirstNameUpdateTextBox"
                  text='<%# Bind("FirstName") %>'
                  runat="server"/>
                <asp:textbox id="LastNameUpdateTextBox"
                  text='<%# Bind("LastName") %>'
                  runat="server"/>
              </td>
            </tr>
            <tr>
              <td>
                <b>Title:</b>
              </td>
              <td>
                <asp:textbox id="TitleUpdateTextBox"
                  text='<%# Bind("Title") %>'
                  runat="server"/> 
              </td>
            </tr>
            <tr>
              <td>
                <b>Hire Date:</b>                 
              </td>
              <td>
                <asp:textbox id="HireDateUpdateTextBox"
                  text='<%# Bind("HireDate", "{0:d}") %>'
                  runat="server"/>
              </td>
            </tr>
            <tr style="height:150; vertical-align:top">
              <td>
                <b>Address:</b>
              </td>
              <td>
                <asp:textbox id="AddressUpdateTextBox"
                  text='<%# Bind("Address") %>'
                  runat="server"/>
                <br/>
                <asp:textbox id="CityUpdateTextBox"
                  text='<%# Bind("City") %>'
                  runat="server"/> 
                <asp:textbox id="RegionUpdateTextBox"
                  text='<%# Bind("Region") %>'
                  width="40"
                  runat="server"/>
                <asp:textbox id="PostalCodeUpdateTextBox"
                  text='<%# Bind("PostalCode") %>'
                  width="60"
                  runat="server"/>
                <br/>
                <asp:textbox id="CountryUpdateTextBox"
                  text='<%# Bind("Country") %>'
                  runat="server"/> 
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <asp:linkbutton id="UpdateButton"
                  text="Update"
                  commandname="Update"
                  runat="server"/>
                <asp:linkbutton id="CancelButton"
                  text="Cancel"
                  commandname="Cancel"
                  runat="server"/> 
              </td>
            </tr>
          </table>       
        </edititemtemplate>
          
        <pagersettings position="Bottom"
          mode="Numeric"/> 
                  
      </asp:formview>
      
      <br/><br/>
      
      <asp:label id="MessageLabel"
          forecolor="Red"
          runat="server"/>
          
      <!-- This example uses Microsoft SQL Server and connects  -->
      <!-- to the Northwind sample database. Use an ASP.NET     -->
      <!-- expression to retrieve the connection string value   -->
      <!-- from the Web.config file.                            -->
      <asp:sqldatasource id="EmployeeSource"
        selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title], [Address], [City], [Region], [PostalCode], [Country], [HireDate], [PhotoPath] From [Employees]"
        updatecommand="Update [Employees] Set [LastName]=@LastName, [FirstName]=@FirstName, [Title]=@Title, [Address]=@Address, [City]=@City, [Region]=@Region, [PostalCode]=@PostalCode, [Country]=@Country Where [EmployeeID]=@EmployeeID"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" 
        runat="server"/>
            
    </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 EmployeeFormView_ItemUpdating(ByVal sender As Object, ByVal e As FormViewUpdateEventArgs) Handles EmployeeFormView.ItemUpdating
  
    ' Validate the field values entered by the user. This
    ' example determines whether the user left any fields
    ' empty. Use the NewValues property to access the new 
    ' values entered by the user.
        Dim emptyFieldList As ArrayList = ValidateFields(e.NewValues)

    If emptyFieldList.Count > 0 Then

      ' The user left some fields empty. Display an error message.
      
      ' Use the Keys property to retrieve the key field value.
      Dim keyValue As String = e.Keys("EmployeeID").ToString()

      MessageLabel.Text = "You must enter a value for each field of record " & _
        keyValue & ".<br/>The following fields are missing:<br/><br/>"

      ' Display the missing fields.
      Dim value As String
      For Each value In emptyFieldList
      
        ' Use the OldValues property to access the original value
        ' of a field.
        MessageLabel.Text &= value & " - Original Value = " & _
          e.OldValues(value).ToString() & "<br />"
        
      Next

      ' Cancel the update operation.
      e.Cancel = True

    Else
    
      ' The field values passed validation. Clear the
      ' error message label.
      MessageLabel.Text = ""
      
    End If

  End Sub

  Function ValidateFields(ByVal list As IOrderedDictionary) As ArrayList
    
    ' Create an ArrayList object to store the
    ' names of any empty fields.
    Dim emptyFieldList As New ArrayList()

    ' Iterate though the field values entered by
    ' the user and check for an empty field. Empty
    ' fields contain a null value.
    Dim entry As DictionaryEntry
    
    For Each entry In list
    
      If entry.Value Is String.Empty Then
      
        ' Add the field name to the ArrayList object.
        emptyFieldList.Add(entry.Key.ToString())
        
      End If
      
    Next

    Return emptyFieldList
  
  End Function
  
  Sub EmployeeFormView_ModeChanging(ByVal sender As Object, ByVal e As FormViewModeEventArgs) Handles EmployeeFormView.ModeChanging
  
    If e.CancelingEdit Then
      
      ' The user canceled the update operation.
      ' Clear the error message label.
      MessageLabel.Text = ""
    
    End If
    
  End Sub
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>FormView Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>FormView Example</h3>
                       
      <asp:formview id="EmployeeFormView"
        datasourceid="EmployeeSource"
        allowpaging="true"
        datakeynames="EmployeeID"
        headertext="Employee Record"
        emptydatatext="No employees found."
        runat="server">
        
        <headerstyle backcolor="CornFlowerBlue"
          forecolor="White"
          font-size="14"
          horizontalalign="Center"  
          wrap="false"/>
        <rowstyle backcolor="LightBlue"
          wrap="false"/>
        <pagerstyle backcolor="CornFlowerBlue"/>

        <itemtemplate>
          <table>
            <tr>
              <td rowspan="6">
                <asp:image id="EmployeeImage"
                  imageurl='<%# Eval("PhotoPath") %>'
                  alternatetext='<%# Eval("LastName") %>' 
                  runat="server"/>
              </td>
              <td colspan="2">
                  &nbsp; 
              </td>
            </tr>
            <tr>
              <td>
                <b>Name:</b>
              </td>
              <td>
                <%# Eval("FirstName") %> <%# Eval("LastName") %>
              </td>
            </tr>
            <tr>
              <td>
                <b>Title:</b>
              </td>
              <td>
                <%# Eval("Title") %>
              </td>
            </tr>
            <tr>
              <td>
                <b>Hire Date:</b>                 
              </td>
              <td>
                <%# Eval("HireDate","{0:d}") %>
              </td>
            </tr>
            <tr style="height:150; vertical-align:top">
              <td>
                <b>Address:</b>
              </td>
              <td>
                <%# Eval("Address") %><br/>
                <%# Eval("City") %> <%# Eval("Region") %>
                <%# Eval("PostalCode") %><br/>
                <%# Eval("Country") %>   
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <asp:linkbutton id="Edit"
                  text="Edit"
                  commandname="Edit"
                  runat="server"/> 
              </td>
            </tr>
          </table>       
        </itemtemplate>
        <edititemtemplate>
          <table>
            <tr>
              <td rowspan="6">
                <asp:image id="EmployeeEditImage"
                  imageurl='<%# Eval("PhotoPath") %>'
                  alternatetext='<%# Eval("LastName") %>' 
                  runat="server"/>
              </td>
              <td colspan="2">
                  &nbsp; 
              </td>
            </tr>
            <tr>
              <td>
                <b>Name:</b>
              </td>
              <td>
                <asp:textbox id="FirstNameUpdateTextBox"
                  text='<%# Bind("FirstName") %>'
                  runat="server"/>
                <asp:textbox id="LastNameUpdateTextBox"
                  text='<%# Bind("LastName") %>'
                  runat="server"/>
              </td>
            </tr>
            <tr>
              <td>
                <b>Title:</b>
              </td>
              <td>
                <asp:textbox id="TitleUpdateTextBox"
                  text='<%# Bind("Title") %>'
                  runat="server"/> 
              </td>
            </tr>
            <tr>
              <td>
                <b>Hire Date:</b>                 
              </td>
              <td>
                <asp:textbox id="HireDateUpdateTextBox"
                  text='<%# Bind("HireDate", "{0:d}") %>'
                  runat="server"/>
              </td>
            </tr>
            <tr style="height:150; vertical-align:top">
              <td>
                <b>Address:</b>
              </td>
              <td>
                <asp:textbox id="AddressUpdateTextBox"
                  text='<%# Bind("Address") %>'
                  runat="server"/>
                <br/>
                <asp:textbox id="CityUpdateTextBox"
                  text='<%# Bind("City") %>'
                  runat="server"/> 
                <asp:textbox id="RegionUpdateTextBox"
                  text='<%# Bind("Region") %>'
                  width="40"
                  runat="server"/>
                <asp:textbox id="PostalCodeUpdateTextBox"
                  text='<%# Bind("PostalCode") %>'
                  width="60"
                  runat="server"/>
                <br/>
                <asp:textbox id="CountryUpdateTextBox"
                  text='<%# Bind("Country") %>'
                  runat="server"/> 
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <asp:linkbutton id="UpdateButton"
                  text="Update"
                  commandname="Update"
                  runat="server"/>
                <asp:linkbutton id="CancelButton"
                  text="Cancel"
                  commandname="Cancel"
                  runat="server"/> 
              </td>
            </tr>
          </table>       
        </edititemtemplate>
          
        <pagersettings position="Bottom"
          mode="Numeric"/> 
                  
      </asp:formview>
      
      <br/><br/>
      
      <asp:label id="MessageLabel"
          forecolor="Red"
          runat="server"/>
          
      <!-- This example uses Microsoft SQL Server and connects  -->
      <!-- to the Northwind sample database. Use an ASP.NET     -->
      <!-- expression to retrieve the connection string value   -->
      <!-- from the Web.config file.                            -->
      <asp:sqldatasource id="EmployeeSource"
        selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title], [Address], [City], [Region], [PostalCode], [Country], [HireDate], [PhotoPath] From [Employees]"
        updatecommand="Update [Employees] Set [LastName]=@LastName, [FirstName]=@FirstName, [Title]=@Title, [Address]=@Address, [City]=@City, [Region]=@Region, [PostalCode]=@PostalCode, [Country]=@Country Where [EmployeeID]=@EmployeeID"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" 
        runat="server"/>
            
    </form>
  </body>
</html>

下列範例示範如何使用FormView控制項來插入新的記錄。The following example demonstrates how to use a FormView control to insert new records.

重要

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


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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>FormView InsertItemTemplate Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>FormView InsertItemTemplate Example</h3>
                       
      <asp:formview id="EmployeeFormView"
        datasourceid="EmployeeSource"
        allowpaging="true"
        datakeynames="EmployeeID"
        emptydatatext="No employees found."  
        runat="server">
        
        <rowstyle backcolor="LightGreen"
          wrap="false"/>
        <insertrowstyle backcolor="LightBlue"
          wrap="false"/>

        <itemtemplate>
          <table>
            <tr>
              <td rowspan="5">
                <asp:image id="CompanyLogoImage"
                  imageurl="~/Images/Logo.jpg"
                  alternatetext="Company logo"
                  runat="server"/>
              </td>
              <td colspan="2">
                  &nbsp; 
              </td>
            </tr>
            <tr>
              <td>
                <b>Name:</b>
              </td>
              <td>
                <%# Eval("FirstName") %> <%# Eval("LastName") %>
              </td>
            </tr>
            <tr>
              <td>
                <b>Title:</b>
              </td>
              <td>
                <%# Eval("Title") %>
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <asp:linkbutton id="NewButton"
                  text="New"
                  commandname="New"
                  runat="server"/> 
              </td>
            </tr>
          </table>       
        </itemtemplate>
        <insertitemtemplate>
          <table>
            <tr>
              <td rowspan="4">
                <asp:image id="CompanyLogoEditImage"
                  imageurl="~/Images/Logo.jpg"
                  alternatetext="Company logo"
                  runat="server"/>
              </td>
              <td colspan="2">
                  &nbsp; 
              </td>
            </tr>
            <tr>
              <td>
                <b><asp:Label runat="server" 
                  AssociatedControlID="FirstNameInsertTextBox" 
                  Text="Name" />:</b>
              </td>
              <td>
                <asp:textbox id="FirstNameInsertTextBox"
                  text='<%# Bind("FirstName") %>'
                  runat="server"/>
                <asp:textbox id="LastNameInsertTextBox"
                  text='<%# Bind("LastName") %>'
                  runat="server"/>
              </td>
            </tr>
            <tr>
              <td>
                <b><asp:Label runat="server" 
                  AssociatedControlID="TitleInsertTextBox" 
                  Text="Title" />:</b>
              </td>
              <td>
                <asp:textbox id="TitleInsertTextBox"
                  text='<%# Bind("Title") %>'
                  runat="server"/> 
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <asp:linkbutton id="InsertButton"
                  text="Insert"
                  commandname="Insert"
                  runat="server" />
                <asp:linkbutton id="CancelButton"
                  text="Cancel"
                  commandname="Cancel"
                  runat="server" /> 
              </td>
            </tr>
          </table>       
        </insertitemtemplate> 
                  
      </asp:formview>

      <!-- This example uses Microsoft SQL Server and connects  -->
      <!-- to the Northwind sample database. Use an ASP.NET     -->
      <!-- expression to retrieve the connection string value   -->
      <!-- from the Web.config file.                            -->
      <asp:sqldatasource id="EmployeeSource"
        selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title], [PhotoPath] From [Employees]"
        insertcommand="Insert Into [Employees] ([LastName], [FirstName], [Title]) VALUES (@LastName, @FirstName, @Title)"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" 
        runat="server"/>
            
    </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>FormView InsertItemTemplate Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>FormView InsertItemTemplate Example</h3>
                       
      <asp:formview id="EmployeeFormView"
        datasourceid="EmployeeSource"
        allowpaging="true"
        datakeynames="EmployeeID"
        emptydatatext="No employees found."  
        runat="server">
        
        <rowstyle backcolor="LightGreen"
          wrap="false"/>
        <insertrowstyle backcolor="LightBlue"
          wrap="false"/>

        <itemtemplate>
          <table>
            <tr>
              <td rowspan="5">
                <asp:image id="CompanyLogoImage"
                  imageurl="~/Images/Logo.jpg"
                  alternatetext="Company logo"
                  runat="server"/>
              </td>
              <td colspan="2">
                  &nbsp; 
              </td>
            </tr>
            <tr>
              <td>
                <b>Name:</b>
              </td>
              <td>
                <%# Eval("FirstName") %> <%# Eval("LastName") %>
              </td>
            </tr>
            <tr>
              <td>
                <b>Title:</b>
              </td>
              <td>
                <%# Eval("Title") %>
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <asp:linkbutton id="NewButton"
                  text="New"
                  commandname="New"
                  runat="server"/> 
              </td>
            </tr>
          </table>       
        </itemtemplate>
        <insertitemtemplate>
          <table>
            <tr>
              <td rowspan="4">
                <asp:image id="CompanyLogoEditImage"
                  imageurl="~/Images/Logo.jpg"
                  alternatetext="Company logo"
                  runat="server"/>
              </td>
              <td colspan="2">
                  &nbsp; 
              </td>
            </tr>
            <tr>
              <td>
                <b><asp:Label runat="server" 
                  AssociatedControlID="FirstNameInsertTextBox" 
                  Text="Name" />:</b>
              </td>
              <td>
                <asp:textbox id="FirstNameInsertTextBox"
                  text='<%# Bind("FirstName") %>'
                  runat="server"/>
                <asp:textbox id="LastNameInsertTextBox"
                  text='<%# Bind("LastName") %>'
                  runat="server"/>
              </td>
            </tr>
            <tr>
              <td>
                <b><asp:Label runat="server" 
                  AssociatedControlID="TitleInsertTextBox" 
                  Text="Title" />:</b>
              </td>
              <td>
                <asp:textbox id="TitleInsertTextBox"
                  text='<%# Bind("Title") %>'
                  runat="server"/> 
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <asp:linkbutton id="InsertButton"
                  text="Insert"
                  commandname="Insert"
                  runat="server" />
                <asp:linkbutton id="CancelButton"
                  text="Cancel"
                  commandname="Cancel"
                  runat="server" /> 
              </td>
            </tr>
          </table>       
        </insertitemtemplate> 
                  
      </asp:formview>

      <!-- This example uses Microsoft SQL Server and connects  -->
      <!-- to the Northwind sample database. Use an ASP.NET     -->
      <!-- expression to retrieve the connection string value   -->
      <!-- from the Web.config file.                            -->
      <asp:sqldatasource id="EmployeeSource"
        selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title], [PhotoPath] From [Employees]"
        insertcommand="Insert Into [Employees] ([LastName], [FirstName], [Title]) VALUES (@LastName, @FirstName, @Title)"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" 
        runat="server"/>
            
    </form>
  </body>
</html>

備註

本主題內容:In this topic:

簡介Introduction

FormView控制項是用來顯示資料來源中的單一記錄。The FormView control is used to display a single record from a data source. 它類似DetailsView于控制項, 不同之處在于它會顯示使用者定義的範本, 而不是資料欄欄位。It is similar to the DetailsView control, except it displays user-defined templates instead of row fields. 建立自己的範本可讓您在控制資料顯示的方式上有更大的彈性。Creating your own templates gives you greater flexibility in controlling how the data is displayed. FormView控制項支援下列功能:The FormView control supports the following features:

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

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

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

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

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

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

範本Templates

若要讓控制項顯示內容, 您必須為控制項的不同部分建立範本。 FormViewFor the FormView control to display content, you need to create templates for the different parts of the control. 大部分的範本都是選擇性的;不過, 您必須為設定控制項的模式建立範本。Most templates are optional; however, you must create a template for the mode in which the control is configured. 例如, FormView支援插入記錄的控制項必須定義 [插入專案] 範本。For example, a FormView control that supports inserting records must have an insert item template defined. 下表列出您可以建立的不同範本。The following table lists the different templates that you can create.

範本類型Template type 說明Description
EditItemTemplate FormView控制項處於編輯模式時, 定義資料列的內容。Defines the content for the data row when the FormView control is in edit mode. 此範本通常包含輸入控制項和命令按鈕, 使用者可在其中編輯現有的記錄。This template usually contains input controls and command buttons with which the user can edit an existing record.
EmptyDataTemplate 定義當FormView控制項系結至不包含任何記錄的資料來源時, 所顯示之空白資料列的內容。Defines the content for the empty data row displayed when the FormView control is bound to a data source that does not contain any records. 此範本通常包含內容, 以警示使用者資料來源未包含任何記錄。This template usually contains content to alert the user that the data source does not contain any records.
FooterTemplate 定義頁尾資料列的內容。Defines the content for the footer row. 此範本通常會包含您想要在頁尾資料列中顯示的任何其他內容。This template usually contains any additional content you would like to display in the footer row. 注意: 或者, 您可以藉由設定FooterText屬性, 直接指定要在頁尾資料列中顯示的文字。Note: As an alternative, you can simply specify text to display in the footer row by setting the FooterText property.
HeaderTemplate 定義標頭資料列的內容。Defines the content for the header row. 此範本通常會包含您想要顯示在標頭資料列中的任何其他內容。This template usually contains any additional content you would like to display in the header row. 注意: 或者, 您可以藉由設定HeaderText屬性, 直接指定要在標頭資料列中顯示的文字。Note: As an alternative, you can simply specify text to display in the header row by setting the HeaderText property.
ItemTemplate FormView控制項處於唯讀模式時, 定義資料列的內容。Defines the content for the data row when the FormView control is in read-only mode. 此範本通常包含內容以顯示現有記錄的值。This template usually contains content to display the values of an existing record.
InsertItemTemplate FormView控制項處於插入模式時, 定義資料列的內容。Defines the content for the data row when the FormView control is in insert mode. 此範本通常包含輸入控制項和命令按鈕, 使用者可在其中新增記錄。This template usually contains input controls and command buttons with which the user can add a new record.
PagerTemplate 定義當分頁功能已啟用時所顯示的呼機資料列內容 (當AllowPaging屬性設定為true時)。Defines the content for the pager row displayed when the paging feature is enabled (when the AllowPaging property is set to true). 此範本通常包含使用者可以流覽至另一筆記錄的控制項。This template usually contains controls with which the user can navigate to another record. 注意: FormView控制項具有內建的分頁資料列使用者介面 (UI)。Note: The FormView control has a built-in pager row user interface (UI). 只有當您想要建立自己的自訂頁面巡覽列時, 才需要建立呼機範本。You need to create a pager template only if you want to create your own custom pager row.

若要在專案範本中顯示欄位的值, 請使用資料系結運算式。To display the value of a field in an item template, use a data binding expression. 如需資料系結運算式的詳細資訊, 請參閱資料系結運算式語法For more information on data binding expressions, see Data-Binding Expression Syntax.

您可以使用雙向系結運算式, 將 [編輯專案範本] 和 [插入專案] 範本中的輸入控制項系結至資料來源的欄位。Input controls in the edit item template and insert item template can be bound to the fields of a data source by using a two-way binding expression. 這可讓FormView控制項自動將更新或插入作業的輸入控制項值解壓縮。This allows the FormView control to automatically extract the values of the input control for an update or insert operation. 雙向系結運算式也允許 [編輯專案] 範本中的輸入控制項自動顯示原始域值。Two-way binding expressions also allow input controls in an edit item template to automatically display the original field values. 如需雙向系結運算式的詳細資訊, 請參閱系結至資料庫For more information on two-way binding expressions, see Binding to Databases.

系結至資料Binding to Data

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

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

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

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

注意

這個控制項可以用來顯示使用者輸入, 其中可能包含惡意的用戶端腳本。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. 可能的話, 強烈建議在此控制項中顯示值之前, 先以 HTML 編碼。Whenever possible, it is strongly recommended that values are HTML-encoded before they are displayed in this control. ASP.NET 提供輸入要求驗證功能, 以封鎖使用者輸入中的腳本和 HTML。ASP.NET provides an input request validation feature to block script and HTML in user input. 也會提供驗證服務器控制項來評估使用者輸入。Validation server controls are also provided to assess user input. 如需詳細資訊, 請參閱驗證控制項簡介For more information, see Introduction to the Validation Controls.

資料作業Data Operations

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

注意

FormView控制項可以支援使用其他資料來源類型進行更新、刪除、插入及分頁作業; 不過, 您必須為這些作業提供適當的事件處理常式與執行。The FormView control can provide support for update, delete, insert, and paging operations with other types of data sources; however, you must provide an appropriate event handler with the implementation for these operations.

FormView由於控制項使用範本, 因此不會提供自動產生命令按鈕以執行更新、刪除或插入作業的方式。Because the FormView control uses templates, it does not provide a way to automatically generate command buttons to perform updating, deleting, or inserting operations. 您必須以手動方式將這些命令按鈕包含在適當的範本中。You must manually include these command buttons in the appropriate template. 控制項可辨識其CommandName屬性設定為特定值的特定按鈕。 FormViewThe FormView control recognizes certain buttons that have their CommandName properties set to specific values. 下表列出FormView控制項可識別的命令按鈕。The following table lists the command buttons that the FormView control recognizes.

按鈕Button CommandName 值CommandName value 說明Description
取消Cancel 退出"Cancel" 用於更新或插入作業, 以取消操作並捨棄使用者輸入的值。Used in updating or inserting operations to cancel the operation and to discard the values entered by the user. 控制項接著會回到DefaultMode屬性所指定的模式。 FormViewThe FormView control then returns to the mode specified by the DefaultMode property.
刪除Delete "Delete""Delete" 用於刪除作業, 以從資料來源刪除顯示的記錄。Used in deleting operations to delete the displayed record from the data source. ItemDeleting引發和ItemDeleted事件。Raises the ItemDeleting and ItemDeleted events.
EditEdit 編輯"Edit" 用於更新作業, 讓FormView控制項進入編輯模式。Used in updating operations to put the FormView control in edit mode. 會針對資料列顯示EditItemTemplate屬性中指定的內容。The content specified in the EditItemTemplate property is displayed for the data row.
InsertInsert 插入"Insert" 用於插入作業, 以嘗試使用使用者所提供的值, 在資料來源中插入新記錄。Used in inserting operations to attempt to insert a new record in the data source using the values provided by the user. ItemInserting引發和ItemInserted事件。Raises the ItemInserting and ItemInserted events.
新增New "New" 用於插入作業, 讓FormView控制項進入插入模式。Used in inserting operations to put the FormView control in insert mode. 會針對資料列顯示InsertItemTemplate屬性中指定的內容。The content specified in the InsertItemTemplate property is displayed for the data row.
頁面Page 本頁"Page" 在分頁作業中用來代表執行分頁的頁面巡覽列中的按鈕。Used in paging operations to represent a button in the pager row that performs paging. 若要指定分頁作業, 請將CommandArgument按鈕的屬性設定為 [下一步]、[上一個]、[第一個]、[最後一個], 或要導覽之頁面的索引。To specify the paging operation, set the CommandArgument property of the button to "Next", "Prev", "First", "Last", or the index of the page to which to navigate. PageIndexChanging引發和PageIndexChanged事件。Raises the PageIndexChanging and PageIndexChanged events. 注意: 這種類型的按鈕通常僅用於頁面導航模板。Note: This type of button is typically used only in the pager template.
更新Update 更新"Update" 用於更新作業, 嘗試使用使用者所提供的值來更新資料來源中顯示的記錄。Used in updating operations to attempt to update the displayed record in the data source with the values provided by the user. ItemUpdating引發和ItemUpdated事件。Raises the ItemUpdating and ItemUpdated events.

不同于 [刪除] 按鈕 (這會立即刪除顯示的記錄), 按一下FormView [編輯] 或 [新增] 按鈕時, 控制項會分別進入 [編輯] 或 [插入] 模式。Unlike the Delete button (which deletes the displayed record immediately), when the Edit or New button is clicked, the FormView control goes into edit or insert mode, respectively. 在編輯模式中, 會顯示目前資料項目EditItemTemplate的屬性中所包含的內容。In edit mode, the content contained in the EditItemTemplate property is displayed for the current data item. 通常會定義 [編輯專案] 範本, 讓 [編輯] 按鈕取代為 [更新] 和 [取消] 按鈕。Typically, the edit item template is defined such that 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 also usually 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.

同樣地, 當控制項處於插入InsertItemTemplate模式時, 會針對資料項目顯示包含在屬性中的內容。Likewise, the content contained in the InsertItemTemplate property is displayed for the data item when the control is in insert mode. [插入專案] 範本的定義通常是讓 [新增] 按鈕取代為 [插入] 和 [取消] 按鈕, 並顯示空白的輸入控制項, 讓使用者輸入新記錄的值。The insert item template is typically defined such that 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. 按一下 [插入] 按鈕會將記錄插入資料來源中, 而按一下 [取消] 按鈕會放棄任何變更。Clicking the Insert button inserts the record in the data source, while clicking the Cancel button abandons any changes.

FormView控制項提供分頁功能, 可讓使用者流覽至資料來源中的其他記錄。The FormView control provides a paging feature, which allows the user to navigate to other records in the data source. 啟用時, 會在包含頁面導覽控制項的FormView控制項中顯示 [呼機] 列。When enabled, a pager row is displayed in the FormView control that contains the page navigation controls. 若要啟用分頁, 請AllowPaging將屬性true設定為。To enable paging, set the AllowPaging property to true. 您可以藉由設定包含在PagerStyle PagerSettings和屬性中的物件屬性來自訂頁面巡覽列。You can customize the pager row by setting the properties of objects contained in the PagerStyle and the PagerSettings property. 您可以使用PagerTemplate屬性來建立自己的 ui, 而不是使用內建的分頁資料列 ui。Instead of using the built-in pager row UI, you can create your own UI by using the PagerTemplate property.

自訂使用者介面Customizing the User Interface

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

Style 屬性Style property 說明Description
EditRowStyle FormView控制項處於編輯模式時, 資料列的樣式設定。The style settings for the data row when the FormView control is in edit mode.
EmptyDataRowStyle 當資料來源不包含任何記錄時, FormView控制項中顯示之空白資料列的樣式設定。The style settings for the empty data row displayed in the FormView control when the data source does not contain any records.
FooterStyle FormView控制項頁尾資料列的樣式設定。The style settings for the footer row of the FormView control.
HeaderStyle FormView控制項之標頭資料列的樣式設定。The style settings for the header row of the FormView control.
InsertRowStyle FormView控制項處於插入模式時, 資料列的樣式設定。The style settings for the data row when the FormView control is in insert mode.
PagerStyle 啟用分頁功能時, 在FormView控制項中顯示之分頁列的樣式設定。The style settings for the pager row displayed in the FormView control when the paging feature is enabled.
RowStyle FormView控制項處於唯讀模式時, 資料列的樣式設定。The style settings for the data row when the FormView control is in read-only mode.

事件Events

FormView控制項提供幾個您可以針對進行程式設計的事件。The FormView control provides several events that you can program against. 這可讓您在每次發生事件時執行自訂常式。This allows you to run a custom routine whenever an event occurs. 下表列出FormView控制項支援的事件。The following table lists the events supported by the FormView control.

Event - 事件Event 說明Description
ItemCommand 按一下 FormView 控制項中的按鈕時會發生這個事件。Occurs when a button within a FormView control is clicked. 當您按一下控制項中的按鈕時, 通常會使用這個事件來執行工作。This event is often used to perform a task when a button is clicked in the control.
ItemCreated FormViewRow 控制項FormView中建立所有物件之後發生。Occurs after all FormViewRow objects are created in the FormView control. 此事件通常用來在顯示記錄之前修改其值。This event is often used to modify the values of a record before it is displayed.
ItemDeleted 發生于按一下 [ CommandName FormView刪除] 按鈕 (其屬性設為 "delete" 的按鈕) 時, 但在控制項從資料來源刪除記錄之後。Occurs when a Delete button (a button with its CommandName property set to "Delete") is clicked, but after the FormView control deletes the record from the data source. 這個事件通常用來檢查刪除作業的結果。This event is often used to check the results of the delete operation.
ItemDeleting 發生于按一下 [ FormView刪除] 按鈕時, 但在控制項從資料來源刪除記錄之前。Occurs when a Delete button is clicked, but before the FormView control deletes the record from the data source. 這個事件通常用來取消刪除作業。This event is often used to cancel the delete operation.
ItemInserted 發生于按一下 [ CommandName FormView插入] 按鈕 (其屬性設為 "Insert" 的按鈕) 時, 但在控制項插入記錄之後。Occurs when an Insert button (a button with its CommandName property set to "Insert") is clicked, but after the FormView control inserts the record. 這個事件通常用來檢查插入作業的結果。This event is often used to check the results of the insert operation.
ItemInserting 發生于按一下 [ FormView插入] 按鈕時, 但在控制項插入記錄之前。Occurs when an Insert button is clicked, but before the FormView control inserts the record. 這個事件通常用來取消插入作業。This event is often used to cancel the insert operation.
ItemUpdated 發生于按一下 [ CommandName FormView更新] 按鈕 (其屬性設為 "Update" 的按鈕) 時, 但在控制項更新資料列之後。Occurs when an Update button (a button with its CommandName property set to "Update") is clicked, but after the FormView control updates the row. 此事件通常用來檢查更新作業的結果。This event is often used to check the results of the update operation.
ItemUpdating 發生于按一下 [ FormView更新] 按鈕時, 但在控制項更新記錄之前。Occurs when an Update button is clicked, but before the FormView control updates the record. 此事件通常用來取消更新作業。This event is often used to cancel the update operation.
ModeChanged 發生于FormView控制項變更模式 (以編輯、插入或唯讀模式) 之後。Occurs after the FormView control changes modes (to edit, insert, or read-only mode). FormView控制項變更模式時, 通常會使用這個事件來執行工作。This event is often used to perform a task when the FormView control changes modes.
ModeChanging 發生于FormView控制項變更模式之前 (以編輯、插入或唯讀模式)。Occurs before the FormView control changes modes (to edit, insert, or read-only mode). 這個事件通常用來取消模式變更。This event is often used to cancel a mode change.
PageIndexChanged 按一下其中一個頁面巡覽區按鈕時發生 (但在 FormView 控制項處理分頁作業之後)。Occurs when one of the pager buttons is clicked, but after the FormView 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 發生於按一下其中一個頁面巡覽區按鈕時,但是在 FormView 控制項處理分頁作業之前。Occurs when one of the pager buttons is clicked, but before the FormView 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.

套用 CSS 樣式Applying CSS Styles

FormView控制項可讓您在標記中指定 CSS 樣式規則。The FormView control lets you specify CSS style rules in markup. 如果您使用範本來自訂FormView控制項的外觀, 您可以在範本的標記中指定 CSS 樣式。If you use templates to customize the appearance of the FormView control, you can specify CSS styles in the markup in the templates. 在這種情況下, 不需要額外的外部資料表。In that case, no extra outer table is required. 您可以藉由將RenderOuterTable屬性設定為false, 來防止轉譯資料表。You can prevent the table from being rendered by setting the RenderOuterTable property to false.

宣告式語法Declarative Syntax

<asp:FormView  
    AccessKey="string"  
    AllowPaging="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"  
    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"  
    RenderTable="True|False"  
    runat="server"  
    SkinID="string"  
    Style="string"  
    TabIndex="integer"  
    ToolTip="string"  
    Visible="True|False"  
    Width="size"  
>  
        <EditItemTemplate>  
            <!-- child controls -->  
        </EditItemTemplate>  
        <EditRowStyle />  
        <EmptyDataRowStyle />  
        <EmptyDataTemplate>  
            <!-- child controls -->  
        </EmptyDataTemplate>  
        <FooterStyle />  
        <FooterTemplate>  
            <!-- child controls -->  
        </FooterTemplate>  
        <HeaderStyle />  
        <HeaderTemplate>  
            <!-- child controls -->  
        </HeaderTemplate>  
        <InsertItemTemplate>  
            <!-- child controls -->  
        </InsertItemTemplate>  
        <InsertRowStyle />  
        <ItemTemplate>  
            <!-- child controls -->  
        </ItemTemplate>  
        <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:FormView>  

建構函式

FormView() FormView() FormView() FormView()

初始化 FormView 類別的新執行個體。Initializes a new instance of the FormView 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.

AppRelativeTemplateSourceDirectory AppRelativeTemplateSourceDirectory AppRelativeTemplateSourceDirectory AppRelativeTemplateSourceDirectory

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

(Inherited from Control)
Attributes Attributes Attributes Attributes

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

(Inherited from WebControl)
BackColor BackColor BackColor BackColor

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

(Inherited from WebControl)
BackImageUrl BackImageUrl BackImageUrl BackImageUrl

取得或設定要顯示於 FormView 控制項背景之影像的 URL。Gets or sets the URL to an image to display in the background of a FormView 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

取得 FormViewRow 物件,表示顯示於 FormView 控制項下方的頁面巡覽列。Gets the FormViewRow object that represents the pager row displayed at the bottom of the FormView control.

Caption Caption Caption Caption

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

CaptionAlign CaptionAlign CaptionAlign CaptionAlign

取得或設定 FormView 控制項中 HTML 標題項目的水平或垂直位置。Gets or sets the horizontal or vertical position of the HTML caption element in a FormView 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)
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

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

DataItem DataItem DataItem DataItem

取得繫結至 FormView 控制項的資料項目。Gets the data item bound to the FormView 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 data items in the data source.

DataItemIndex DataItemIndex DataItemIndex DataItemIndex

取得資料項目的索引,該資料項目從資料來源繫結至 FormView 控制項。Gets the index of the data item bound to the FormView control from the 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

取得或設定 FormView 控制項會在更新、插入或取消作業後返回的資料輸入模式。Gets or sets the data-entry mode to which the FormView control returns after an update, insert, or cancel operation.

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

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

EditRowStyle EditRowStyle EditRowStyle EditRowStyle

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

EmptyDataRowStyle EmptyDataRowStyle EmptyDataRowStyle EmptyDataRowStyle

取得 TableItemStyle 物件的參考,可以讓您設定當繫結至 FormView 控制項的資料來源不含任何資料錄時,顯示之空白資料列的外觀。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 FormView control does not contain any records.

EmptyDataTemplate EmptyDataTemplate EmptyDataTemplate EmptyDataTemplate

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

EmptyDataText EmptyDataText EmptyDataText EmptyDataText

取得或設定空白資料列中顯示的文字,該資料列呈現於 FormView 控制項繫結至不包含任何資料錄的資料來源時。Gets or sets the text to display in the empty data row rendered when a FormView 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 a validator control will handle exceptions that occur during insert or update operations.

EnableTheming EnableTheming EnableTheming EnableTheming

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

(Inherited from WebControl)
EnableViewState EnableViewState EnableViewState EnableViewState

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

(Inherited from Control)
Events Events Events Events

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

(Inherited from Control)
Font Font Font Font

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

(Inherited from WebControl)
FooterRow FooterRow FooterRow FooterRow

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

FooterStyle FooterStyle FooterStyle FooterStyle

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

FooterTemplate FooterTemplate FooterTemplate FooterTemplate

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

FooterText FooterText FooterText FooterText

取得或設定顯示於 FormView 控制項頁尾資料列的文字。Gets or sets the text to display in the footer row of a FormView 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

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

取得 FormViewRow 物件,表示 FormView 控制項中的頁首資料列。Gets the FormViewRow object that represents the header row in a FormView control.

HeaderStyle HeaderStyle HeaderStyle HeaderStyle

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

HeaderTemplate HeaderTemplate HeaderTemplate HeaderTemplate

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

HeaderText HeaderText HeaderText HeaderText

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

Height Height Height Height

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

(Inherited from WebControl)
HorizontalAlign HorizontalAlign HorizontalAlign HorizontalAlign

取得或設定頁面上 FormView 控制項的水平對齊。Gets or sets the horizontal alignment of a FormView 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)
InsertItemTemplate InsertItemTemplate InsertItemTemplate InsertItemTemplate

取得或設定處於插入模式之項目的自訂內容。Gets or sets the custom content for an item in insert mode.

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 物件的參考,可以讓您在 FormView 控制項處於插入模式時,設定控制項中資料列的外觀。Gets a reference to the TableItemStyle object that allows you to set the appearance of the data row in a FormView control when the 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)
ItemTemplate ItemTemplate ItemTemplate ItemTemplate

取得或設定當 FormView 控制項處於唯讀模式時,控制項中資料列的自訂內容。Gets or sets the custom content for the data row in a FormView control when the control is in read-only mode.

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 total number of pages required to display every record in the data source.

PageIndex PageIndex PageIndex PageIndex

取得或設定顯示頁面的索引。Gets or sets the index of the displayed page.

PagerSettings PagerSettings PagerSettings PagerSettings

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

PagerStyle PagerStyle PagerStyle PagerStyle

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

PagerTemplate PagerTemplate PagerTemplate PagerTemplate

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

取得或設定值,這個值指出控制項是否會將轉譯的 HTML 放置在 table 項目內,以便套用內嵌樣式。Gets or sets a value that indicates whether the control encloses rendered HTML in a table element in order to apply inline styles.

RequiresDataBinding RequiresDataBinding RequiresDataBinding RequiresDataBinding

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

(Inherited from BaseDataBoundControl)
Row Row Row Row

取得 FormViewRow 物件,該物件表示 FormView 控制項中的資料列。Gets the FormViewRow object that represents the data row in a FormView control.

RowStyle RowStyle RowStyle RowStyle

取得 TableItemStyle 物件的參考,可以讓您在 FormView 控制項處於唯讀模式時,設定控制項中資料列的外觀。Gets a reference to the TableItemStyle object that allows you to set the appearance of the data row in a FormView control when the control is in read-only mode.

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

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

取得 FormView 控制項的 HtmlTextWriterTag 值。Gets the HtmlTextWriterTag value for the FormView 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

取得 FormViewRow 物件,表示顯示於 FormView 控制項上方的頁面巡覽列。Gets the FormViewRow object that represents the pager row displayed at the top of a FormView 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(FormViewMode) ChangeMode(FormViewMode) ChangeMode(FormViewMode) ChangeMode(FormViewMode)

FormView 控制項切換至指定的資料輸入模式。Switches the FormView control to the specified data-entry 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)
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)

建立控制階層架構,用來呈現具有指定資料來源的 FormView 控制項。Creates the control hierarchy used to render the FormView control with the specified data source.

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

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

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

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

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

建立包含引數的 DataSourceSelectArguments 物件,這些引數已傳遞至資料來源進行處理。Creates the DataSourceSelectArguments object that contains the arguments that are passed to the data source for processing.

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

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

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

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

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

將資料來源繫結至 FormView 控制項。Binds the data source to the FormView control.

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

從資料來源刪除 FormView 控制項中目前的資料錄。Deletes the current record in the FormView control 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()

請在適當時確定 FormView 控制項已繫結至資料。Makes certain that the FormView control is bound to data when appropriate.

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) ExtractRowValues(IOrderedDictionary, Boolean) ExtractRowValues(IOrderedDictionary, Boolean) ExtractRowValues(IOrderedDictionary, Boolean)

擷取資料列中宣告的每個欄位值,並將它們儲存在指定的 IOrderedDictionary 物件中。Retrieves the values of each field declared within the data row 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)
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(FormViewRow, PagedDataSource) InitializePager(FormViewRow, PagedDataSource) InitializePager(FormViewRow, PagedDataSource) InitializePager(FormViewRow, PagedDataSource)

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

InitializeRow(FormViewRow) InitializeRow(FormViewRow) InitializeRow(FormViewRow) InitializeRow(FormViewRow)

初始化指定的 FormViewRow 物件。Initializes the specified FormViewRow 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)

判斷指定的資料型別是否可以繫結至 FormView 控制項中的欄位。Determines whether the specified data type can be bound to a field in the FormView 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)

載入必須保存的 FormView 控制項屬性狀態 (即使 EnableViewState 屬性設定為 false)。Loads the state of the FormView control properties that need to be persisted, even when the EnableViewState property is set to false.

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

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

判斷與 FormView 控制項關聯的資料表特定 CSS 樣式規則是否設定為其預設值。Determines whether the table-specific CSS style rules that are associated with the FormView control are set to their default values.

OnBubbleEvent(Object, EventArgs) OnBubbleEvent(Object, EventArgs) OnBubbleEvent(Object, EventArgs) OnBubbleEvent(Object, EventArgs)

處理透過控制階層架構向上傳遞的事件。Handles an event passed up through the 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.

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

引發 Init 事件。Raises the Init event.

OnItemCommand(FormViewCommandEventArgs) OnItemCommand(FormViewCommandEventArgs) OnItemCommand(FormViewCommandEventArgs) OnItemCommand(FormViewCommandEventArgs)

引發 ItemCommand 事件。Raises the ItemCommand event.

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

引發 ItemCreated 事件。Raises the ItemCreated event.

OnItemDeleted(FormViewDeletedEventArgs) OnItemDeleted(FormViewDeletedEventArgs) OnItemDeleted(FormViewDeletedEventArgs) OnItemDeleted(FormViewDeletedEventArgs)

引發 ItemDeleted 事件。Raises the ItemDeleted event.

OnItemDeleting(FormViewDeleteEventArgs) OnItemDeleting(FormViewDeleteEventArgs) OnItemDeleting(FormViewDeleteEventArgs) OnItemDeleting(FormViewDeleteEventArgs)

引發 ItemDeleting 事件。Raises the ItemDeleting event.

OnItemInserted(FormViewInsertedEventArgs) OnItemInserted(FormViewInsertedEventArgs) OnItemInserted(FormViewInsertedEventArgs) OnItemInserted(FormViewInsertedEventArgs)

引發 ItemInserted 事件。Raises the ItemInserted event.

OnItemInserting(FormViewInsertEventArgs) OnItemInserting(FormViewInsertEventArgs) OnItemInserting(FormViewInsertEventArgs) OnItemInserting(FormViewInsertEventArgs)

引發 ItemInserting 事件。Raises the ItemInserting event.

OnItemUpdated(FormViewUpdatedEventArgs) OnItemUpdated(FormViewUpdatedEventArgs) OnItemUpdated(FormViewUpdatedEventArgs) OnItemUpdated(FormViewUpdatedEventArgs)

引發 ItemUpdated 事件。Raises the ItemUpdated event.

OnItemUpdating(FormViewUpdateEventArgs) OnItemUpdating(FormViewUpdateEventArgs) OnItemUpdating(FormViewUpdateEventArgs) OnItemUpdating(FormViewUpdateEventArgs)

引發 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(FormViewModeEventArgs) OnModeChanging(FormViewModeEventArgs) OnModeChanging(FormViewModeEventArgs) OnModeChanging(FormViewModeEventArgs)

引發 ModeChanging 事件。Raises the ModeChanging event.

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

引發 PageIndexChanged 事件。Raises the PageIndexChanged event.

OnPageIndexChanging(FormViewPageEventArgs) OnPageIndexChanging(FormViewPageEventArgs) OnPageIndexChanging(FormViewPageEventArgs) OnPageIndexChanging(FormViewPageEventArgs)

引發 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.

(Inherited from DataBoundControl)
OnPreRender(EventArgs) OnPreRender(EventArgs) OnPreRender(EventArgs) OnPreRender(EventArgs)

處理 PreRender 事件。Handles the PreRender event.

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

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

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

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

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

設定 FormView 控制項的控制階層架構。Sets up the control hierarchy of the FormView 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)
RaisePostBackEvent(String) RaisePostBackEvent(String) RaisePostBackEvent(String) RaisePostBackEvent(String)

回傳至伺服器時引發 FormView 控制項的適當事件。Raises the appropriate events for the FormView 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)

在用戶端顯示 FormView 物件。Displays the FormView control on the client.

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

儲存必須保存的 FormView 控制項屬性狀態 (即使 EnableViewState 屬性設定為 false)。Saves the state of the FormView control properties that need to be persisted, even when the EnableViewState property is set to false.

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

儲存 FormView 控制項的目前檢視狀態。Saves the current view state of the FormView 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)

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

標示起點,在此開始追蹤,並將檢視狀態變更儲存至 FormView 控制項。Marks the starting point at which to begin tracking and saving view-state changes to the FormView 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

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

ItemCreated ItemCreated ItemCreated ItemCreated

發生在 FormView 控制項中建立所有資料列之後。Occurs after all the rows are created in a FormView control.

ItemDeleted ItemDeleted ItemDeleted ItemDeleted

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

ItemDeleting ItemDeleting ItemDeleting ItemDeleting

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

ItemInserted ItemInserted ItemInserted ItemInserted

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

ItemInserting ItemInserting ItemInserting ItemInserting

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

ItemUpdated ItemUpdated ItemUpdated ItemUpdated

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

ItemUpdating ItemUpdating ItemUpdating ItemUpdating

發生於按一下 FormView 控制項內的 [更新] 按鈕時,但在更新作業之前。Occurs when an Update button within a FormView 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

發生於 FormView 控制項在編輯、插入和唯讀模式之間切換時,但在模式變更後。Occurs when the FormView control switches between edit, insert, and read-only mode, but after the mode has changed.

ModeChanging ModeChanging ModeChanging ModeChanging

FormView 控制項在編輯、插入和唯讀模式之間切換,但在模式尚未變更之前發生。Occurs when the FormView control switches between edit, insert, and read-only mode, but before the mode changes.

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

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

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

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

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

取得或設定物件,這個物件包含 FormView 控制項會擷取的資料清單。Gets or sets the object that contains the list of data that the FormView control retrieves.

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

取得或設定資料來源控制項的 ID,這個控制項包含 FormView 控制項會擷取的資料項目清單。Gets or sets the ID of the data source control that contains the list of data items that the FormView control retrieves.

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

取得資料來源物件,這個物件包含 FormView 控制項會擷取的資料項目清單。Gets the data source object that contains the list of data items that the FormView control retrieves.

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

取得物件,這個物件表示 FormView 控制項中資料列的資料索引鍵值。Gets the object that represents the data-key value of the row in the FormView control.

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

取得 FormView 控制項目前的模式。Gets the current mode of the FormView control.

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.

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)

判斷 FormView 控制項的回傳事件選項。Determines the postback event options for the FormView control.

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

回傳至伺服器時,便會引發 FormView 控制項的事件。Raises events for the FormView control when it posts back to the server.

擴充方法

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.

適用於

另請參閱