EditCommandColumn 類別

定義

DataGrid 控制項的特殊資料行類型,其中包含 Edit 按鈕來編輯每個資料列中的資料項目。A special column type for the DataGrid control that contains the Edit buttons for editing data items in each row.

public ref class EditCommandColumn : System::Web::UI::WebControls::DataGridColumn
public class EditCommandColumn : System.Web.UI.WebControls.DataGridColumn
type EditCommandColumn = class
    inherit DataGridColumn
Public Class EditCommandColumn
Inherits DataGridColumn
繼承
EditCommandColumn

範例

下列程式碼範例示範如何將物件加入 EditCommandColumnDataGrid 控制項。The following code example demonstrates how to add an EditCommandColumn object to a DataGrid control.


<%@ Page Language="C#" AutoEventWireup="True" %>
<%@ Import Namespace="System.Data" %>
 
<!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" >
   <script runat="server">
 
      // The Cart and CartView objects temporarily store the data source
      // for the DataGrid control while the page is being processed.
      DataTable Cart = new DataTable();
      DataView CartView;   
 
      void Page_Load(Object sender, EventArgs e) 
      {
 
         // With a database, use an select query to retrieve the data. Because 
         // the data source in this example is an in-memory DataTable, retrieve
         // the data from session state if it exists; otherwise, create the data
         // source.
         GetSource();

         // The DataGrid control maintains state between posts to the server;
         // it only needs to be bound to a data source the first time the page
         // is loaded or when the data source is updated.
         if (!IsPostBack)
         {

            BindGrid();

         }
                   
      }
 
      void ItemsGrid_Edit(Object sender, DataGridCommandEventArgs e) 
      {

         // Set the EditItemIndex property to the index of the item clicked 
         // in the DataGrid control to enable editing for that item. Be sure
         // to rebind the DateGrid to the data source to refresh the control.
         ItemsGrid.EditItemIndex = e.Item.ItemIndex;
         BindGrid();

      }
 
      void ItemsGrid_Cancel(Object sender, DataGridCommandEventArgs e) 
      {

         // Set the EditItemIndex property to -1 to exit editing mode. 
         // Be sure to rebind the DateGrid to the data source to refresh
         // the control.
         ItemsGrid.EditItemIndex = -1;
         BindGrid();

      }
 
      void ItemsGrid_Update(Object sender, DataGridCommandEventArgs e) 
      {

         // Retrieve the text boxes that contain the values to update.
         // For bound columns, the edited value is stored in a TextBox.
         // The TextBox is the 0th control in a cell's Controls collection.
         // Each cell in the Cells collection of a DataGrid item represents
         // a column in the DataGrid control.
         TextBox qtyText = (TextBox)e.Item.Cells[3].Controls[0];
         TextBox priceText = (TextBox)e.Item.Cells[4].Controls[0];
 
         // Retrieve the updated values.
         String item = e.Item.Cells[2].Text;
         String qty = qtyText.Text;
         String price = priceText.Text;
        
         DataRow dr;
 
         // With a database, use an update command to update the data. 
         // Because the data source in this example is an in-memory 
         // DataTable, delete the old row and replace it with a new one.
 
         // Remove the old entry and clear the row filter.
         CartView.RowFilter = "Item='" + item + "'";
         if (CartView.Count > 0)
         {
            CartView.Delete(0);
         }
         CartView.RowFilter = "";
 
         // ***************************************************************
         // Insert data validation code here. Be sure to validate the
         // values entered by the user before converting to the appropriate
         // data types and updating the data source.
         // ***************************************************************

         // Add the new entry.
         dr = Cart.NewRow();
         dr[0] = Convert.ToInt32(qty);
         dr[1] = item;

         // If necessary, remove the '$' character from the price before 
         // converting it to a Double.
         if(price[0] == '$')
         {
            dr[2] = Convert.ToDouble(price.Substring(1));
         }
         else
         {
            dr[2] = Convert.ToDouble(price);
         }

         Cart.Rows.Add(dr);
 
         // Set the EditItemIndex property to -1 to exit editing mode. 
         // Be sure to rebind the DateGrid to the data source to refresh
         // the control.
         ItemsGrid.EditItemIndex = -1;
         BindGrid();

      }
 
      void BindGrid() 
      {

         // Set the data source and bind to the Data Grid control.
         ItemsGrid.DataSource = CartView;
         ItemsGrid.DataBind();

      }

      void GetSource()
      {

         // For this example, the data source is a DataTable that is stored
         // in session state. If the data source does not exist, create it;
         //  otherwise, load the data.
         if (Session["ShoppingCart"] == null) 
         {     

            // Create the sample data.
            DataRow dr;  
 
            // Define the columns of the table.
            Cart.Columns.Add(new DataColumn("Qty", typeof(Int32)));
            Cart.Columns.Add(new DataColumn("Item", typeof(String)));
            Cart.Columns.Add(new DataColumn("Price", typeof(Double)));

            // Store the table in session state to persist its values 
            // between posts to the server.
            Session["ShoppingCart"] = Cart;
             
            // Populate the DataTable with sample data.
            for (int i = 1; i <= 9; i++) 
            {
               dr = Cart.NewRow();
               if (i % 2 != 0)
               {
                  dr[0] = 2;
               }
               else
               {
                  dr[0] = 1;
               }
               dr[1] = "Item " + i.ToString();
               dr[2] = (1.23 * (i + 1));
               Cart.Rows.Add(dr);
            }

         } 

         else
         {

            // Retrieve the sample data from session state.
            Cart = (DataTable)Session["ShoppingCart"];

         }         
 
         // Create a DataView and specify the field to sort by.
         CartView = new DataView(Cart);
         CartView.Sort="Item";

         return;

      }

      void ItemsGrid_Command(Object sender, DataGridCommandEventArgs e)
      {

         switch(((LinkButton)e.CommandSource).CommandName)
         {

            case "Delete":
               DeleteItem(e);
               break;

            // Add other cases here, if there are multiple ButtonColumns in 
            // the DataGrid control.

            default:
               // Do nothing.
               break;

         }

      }

      void DeleteItem(DataGridCommandEventArgs e)
      {

         // e.Item is the table row where the command is raised. For bound
         // columns, the value is stored in the Text property of a TableCell.
         TableCell itemCell = e.Item.Cells[2];
         string item = itemCell.Text;

         // Remove the selected item from the data source.         
         CartView.RowFilter = "Item='" + item + "'";
         if (CartView.Count > 0) 
         {     
            CartView.Delete(0);
         }
         CartView.RowFilter = "";

         // Rebind the data source to refresh the DataGrid control.
         BindGrid();

      }
 
   </script>
 
<head runat="server">
    <title>DataGrid Editing Example</title>
</head>
<body>
 
   <form id="form1" runat="server">

      <h3>DataGrid Editing Example</h3>
 
      <asp:DataGrid id="ItemsGrid"
           BorderColor="black"
           BorderWidth="1"
           CellPadding="3"
           OnEditCommand="ItemsGrid_Edit"
           OnCancelCommand="ItemsGrid_Cancel"
           OnUpdateCommand="ItemsGrid_Update"
           OnItemCommand="ItemsGrid_Command"
           AutoGenerateColumns="false"
           runat="server">

         <HeaderStyle BackColor="#aaaadd">
         </HeaderStyle>
 
         <Columns>

            <asp:EditCommandColumn
                 EditText="Edit"
                 CancelText="Cancel"
                 UpdateText="Update" 
                 HeaderText="Edit item">

               <ItemStyle Wrap="False">
               </ItemStyle>

               <HeaderStyle Wrap="False">
               </HeaderStyle>

            </asp:EditCommandColumn>

            <asp:ButtonColumn 
                 HeaderText="Delete item" 
                 ButtonType="LinkButton" 
                 Text="Delete" 
                 CommandName="Delete"/>  
 
            <asp:BoundColumn HeaderText="Item" 
                 ReadOnly="True" 
                 DataField="Item"/>
 
            <asp:BoundColumn HeaderText="Quantity" 
                 DataField="Qty"/>
 
            <asp:BoundColumn HeaderText="Price"
                 DataField="Price"
                 DataFormatString="{0:c}"/>
 
         </Columns>
 
      </asp:DataGrid>

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


<%@ Page Language="VB" AutoEventWireup="True" %>
<%@ Import Namespace="System.Data" %>
 
<!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" >
   <script runat="server">
 
      ' The Cart and CartView objects temporarily store the data source
      ' for the DataGrid control while the page is being processed.
      Dim Cart As DataTable = New DataTable()
      Dim CartView As DataView    
 
      Sub Page_Load(sender As Object, e As EventArgs) 
 
         ' With a database, use an select query to retrieve the data. Because 
         ' the data source in this example is an in-memory DataTable, retrieve
         ' the data from session state if it exists; otherwise create the data
         ' source.
         GetSource()

         ' The DataGrid control maintains state between posts to the server;
         ' it only needs to be bound to a data source the first time the page
         ' is loaded or when the data source is updated.
         If Not IsPostBack Then

            BindGrid()

         End If
                   
      End Sub
 
      Sub ItemsGrid_Edit(sender As Object, e As DataGridCommandEventArgs) 

         ' Set the EditItemIndex property to the index of the item clicked 
         ' in the DataGrid control to enable editing for that item. Be sure
         ' to rebind the DateGrid to the data source to refresh the control.
         ItemsGrid.EditItemIndex = e.Item.ItemIndex
         BindGrid()

      End Sub
 
      Sub ItemsGrid_Cancel(sender As Object, e As DataGridCommandEventArgs) 

         ' Set the EditItemIndex property to -1 to exit editing mode.
         ' Be sure to rebind the DateGrid to the data source to refresh
         ' the control.
         ItemsGrid.EditItemIndex = -1
         BindGrid()

      End Sub
 
      Sub ItemsGrid_Update(sender As Object, e As DataGridCommandEventArgs) 

         ' Retrieve the text boxes that contain the values to update.
         ' For bound columns, the edited value is stored in a TextBox.
         ' The TextBox is the 0th control in a cell's Controls collection.
         ' Each cell in the Cells collection of a DataGrid item represents
         ' a column in the DataGrid control.
         Dim qtyText As TextBox = CType(e.Item.Cells(3).Controls(0), TextBox)
         Dim priceText As TextBox = CType(e.Item.Cells(4).Controls(0), TextBox)
 
         ' Retrieve the updated values.
         Dim item As String = e.Item.Cells(2).Text
         Dim qty As String = qtyText.Text
         Dim price As String = priceText.Text
        
         Dim dr As DataRow
 
         ' With a database, use an update command to update the data. 
         ' Because the data source in this example is an in-memory 
         ' DataTable, delete the old row and replace it with a new one.
 
         ' Remove the old entry and clear the row filter.
         CartView.RowFilter = "Item='" & item & "'"
         If CartView.Count > 0 Then
       
            CartView.Delete(0)
         
         End If 
         CartView.RowFilter = ""
 
         ' ***************************************************************
         ' Insert data validation code here. Be sure to validate the
         ' values entered by the user before converting to the appropriate
         ' data types and updating the data source.
         ' ***************************************************************

         ' Add the new entry.
         dr = Cart.NewRow()
         dr(0) = Convert.ToInt32(qty)
         dr(1) = item

         ' If necessary, remove the '$' character from the price before 
         ' converting it to a Double.
         If price.Chars(0) = "$" Then
         
            dr(2) = Convert.ToDouble(price.Substring(1))
         
         Else
         
            dr(2) = Convert.ToDouble(price)
         
         End If

         Cart.Rows.Add(dr)
 
         ' Set the EditItemIndex property to -1 to exit editing mode.
         ' Be sure to rebind the DateGrid to the data source to refresh
         ' the control.
         ItemsGrid.EditItemIndex = -1
         BindGrid()

      End Sub
 
      Sub BindGrid() 

         ' Set the data source and bind to the Data Grid control.
         ItemsGrid.DataSource = CartView
         ItemsGrid.DataBind()

      End Sub

      Sub GetSource()

         ' For this example, the data source is a DataTable that is stored
         ' in session state. If the data source does not exist, create it;
         ' otherwise, load the data.
         If Session("ShoppingCart") Is Nothing Then 

            ' Create the sample data.
            Dim dr As DataRow  
 
            ' Define the columns of the table.
            Cart.Columns.Add(new DataColumn("Qty", GetType(Int32)))
            Cart.Columns.Add(new DataColumn("Item", GetType(String)))
            Cart.Columns.Add(new DataColumn("Price", GetType(Double)))

            ' Store the table in session state to persist its values
            ' between posts to the server.
            Session("ShoppingCart") = Cart
             
            ' Populate the DataTable with sample data.
            Dim i As Integer

            For i = 1 To 9 
            
               dr = Cart.NewRow()
               If (i Mod 2) <> 0 Then

                  dr(0) = 2
               
               Else
               
                  dr(0) = 1
               
               End If

               dr(1) = "Item " & i.ToString()
               dr(2) = (1.23 * (i + 1))
               Cart.Rows.Add(dr)
            
            Next i

         Else

            ' Retrieve the sample data from session state.
            Cart = CType(Session("ShoppingCart"), DataTable)

         End If         
 
         ' Create a DataView and specify the field to sort by.
         CartView = New DataView(Cart)
         CartView.Sort="Item"

         Return

      End Sub

      Sub ItemsGrid_Command(sender As Object, e As DataGridCommandEventArgs)

         Select (CType(e.CommandSource, LinkButton)).CommandName

            Case "Delete"
               DeleteItem(e)

            ' Add other cases here, if there are multiple ButtonColumns in 
            ' the DataGrid control.

            Case Else
               ' Do nothing.

         End Select

      End Sub

      Sub DeleteItem(e As DataGridCommandEventArgs)

         ' e.Item is the table row where the command is raised. For bound 
         ' columns, the value is stored in the Text property of a TableCell.
         Dim itemCell As TableCell = e.Item.Cells(2)
         Dim item As String = itemCell.Text

         ' Remove the selected item from the data source.         
         CartView.RowFilter = "Item='" & item + "'"
         If CartView.Count > 0 Then 
              
            CartView.Delete(0)

         End If
         
         CartView.RowFilter = ""

         ' Rebind the data source to refresh the DataGrid control.
         BindGrid()

      End Sub
 
   </script>
 
<head runat="server">
    <title>DataGrid Editing Example</title>
</head>
<body>
 
   <form id="form1" runat="server">

      <h3>DataGrid Editing Example</h3>
 
      <asp:DataGrid id="ItemsGrid"
           BorderColor="black"
           BorderWidth="1"
           CellPadding="3"
           OnEditCommand="ItemsGrid_Edit"
           OnCancelCommand="ItemsGrid_Cancel"
           OnUpdateCommand="ItemsGrid_Update"
           OnItemCommand="ItemsGrid_Command"
           AutoGenerateColumns="false"
           runat="server">

         <HeaderStyle BackColor="#aaaadd">
         </HeaderStyle>
 
         <Columns>

            <asp:EditCommandColumn
                 EditText="Edit"
                 CancelText="Cancel"
                 UpdateText="Update" 
                 HeaderText="Edit item">

               <ItemStyle Wrap="False">
               </ItemStyle>

               <HeaderStyle Wrap="False">
               </HeaderStyle>

            </asp:EditCommandColumn>

            <asp:ButtonColumn 
                 HeaderText="Delete item" 
                 ButtonType="LinkButton" 
                 Text="Delete" 
                 CommandName="Delete"/>  
 
            <asp:BoundColumn HeaderText="Item" 
                 ReadOnly="True" 
                 DataField="Item"/>
 
            <asp:BoundColumn HeaderText="Quantity" 
                 DataField="Qty"/>
 
            <asp:BoundColumn HeaderText="Price"
                 DataField="Price"
                 DataFormatString="{0:c}"/>
 
         </Columns>
 
      </asp:DataGrid>

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

備註

EditCommandColumn 可以使用類別來建立控制項的特殊 DataGrid Edit 資料行,其中包含 Update Cancel 方格中每個資料列的、和按鈕。Use the EditCommandColumn class to create a special column for the DataGrid control that contains the Edit, Update, and Cancel buttons for each data row in the grid. 這些按鈕可讓您編輯控制項中資料列的值 DataGridThese buttons allow you to edit the values of a row in the DataGrid control.

如果未選取任何列, Edit EditCommandColumn 控制項中每個資料列的物件就會顯示一個按鈕 DataGridIf no row is selected, an Edit button displays in the EditCommandColumn object for each data row in the DataGrid control. Edit按一下專案的按鈕時,就 EditCommand 會引發事件,並 EditUpdate 和按鈕取代按鈕 CancelWhen the Edit button for an item is clicked, the EditCommand event is raised and the Edit button is replaced with the Update and Cancel buttons. 您需要提供程式碼來處理 EditCommand 事件。You need to provide code to handle the EditCommand event. 一般事件處理常式會將 EditItemIndex 屬性設定為選取的資料列,然後將資料重新系結至 DataGrid 控制項。A typical event handler sets the EditItemIndex property to the selected row, and then rebinds the data to the DataGrid control.

注意

您必須提供 CancelTextEditText 和屬性的值 UpdateTextYou must provide values for the CancelText, EditText, and UpdateText properties. 否則,相關聯的按鈕不會出現在中 EditCommandColumnOtherwise, the associated buttons will not appear in the EditCommandColumn.

您可以設定屬性,將中的按鈕 EditCommandColumn 設為顯示為超連結或按下按鈕 ButtonTypeThe buttons in the EditCommandColumn can be set to display as hyperlinks or push buttons by setting the ButtonType property.

按一下 UpdateCancel 按鈕會分別引發 UpdateCommandCancelCommand 事件。Clicking the Update or Cancel button raises the UpdateCommand or CancelCommand event, respectively. 您需要提供程式碼來處理這些事件。You need to provide code to handle these events.

事件的一般處理常式會 UpdateCommand 更新資料、將屬性設定 EditItemIndex-1 (以取消選取專案) ,然後將資料重新系結至 DataGrid 控制項。A typical handler for the UpdateCommand event updates the data, sets the EditItemIndex property to -1 (to deselect the item), and then rebinds the data to the DataGrid control.

事件的一般處理常式會 CancelCommandEditItemIndex 屬性設定為 -1 (以取消選取) 的專案,然後將資料重新系結至 DataGrid 控制項。A typical handler for the CancelCommand event sets the EditItemIndex property to -1 (to deselect the item), and then rebinds the data to the DataGrid control.

警告

EditCommandColumn物件可以用來顯示使用者輸入,其中可能包含惡意的用戶端腳本。The EditCommandColumn object 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. 您可以使用驗證控制項來驗證使用者輸入,然後才在控制項中顯示輸入文字 DataGridYou can use validation controls to verify user input before displaying the input text in a DataGrid control. ASP.NET 提供輸入要求驗證功能,以封鎖使用者輸入中的腳本和 HTML。ASP.NET provides an input request validation feature to block script and HTML in user input. 如需詳細資訊,請參閱 保護標準控制項如何:在 Web 應用程式中防止腳本惡意探索,方法是將 HTML 編碼套用至字串,並 在 ASP.NET Web Pages 中驗證使用者輸入For more information, see Securing Standard Controls, How to: Protect Against Script Exploits in a Web Application by Applying HTML Encoding to Strings, and Validating User Input in ASP.NET Web Pages.

根據預設,當 Update 按一下控制項中的按鈕時,就會執行頁面驗證 EditCommandColumnBy default, page validation is performed when an Update button in the EditCommandColumn control is clicked. 頁面驗證會決定與頁面上的驗證控制項相關聯的輸入控制項,是否全部通過驗證控制項所指定的驗證規則。Page validation determines whether the input controls that are associated with a validation control on the page all pass the validation rules that are specified by the validation control. 若要防止發生頁面驗證,請將 CausesValidation 屬性設定為 falseTo prevent page validation from occurring, set the CausesValidation property to false.

建構函式

EditCommandColumn()

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

屬性

ButtonType

取得或設定資料行的按鈕類型。Gets or sets the button type for the column.

CancelText

取得或設定要顯示於 EditCommandColumnCancel 命令按鈕的文字。Gets or sets the text to display for the Cancel command button in the EditCommandColumn.

CausesValidation

取得或設定值,表示按一下 EditCommandColumn 物件中的 [Update] 按鈕時,是否執行驗證。Gets or sets a value indicating whether validation is performed when an Update button in the EditCommandColumn object is clicked.

DesignMode

取得值,指出資料行是否處在設計模式中。Gets a value that indicates whether the column is in design mode.

(繼承來源 DataGridColumn)
EditText

取得或設定要顯示於 EditCommandColumn 中 [Edit] 按鈕的文字。Gets or sets the text to display for the Edit button in the EditCommandColumn.

FooterStyle

取得資料行行尾區段的樣式屬性。Gets the style properties for the footer section of the column.

(繼承來源 DataGridColumn)
FooterText

取得或設定顯示於資料行行尾區段的文字。Gets or sets the text displayed in the footer section of the column.

(繼承來源 DataGridColumn)
HeaderImageUrl

取得或設定要顯示於資料行行首區段的影像位置。Gets or sets the location of an image to display in the header section of the column.

(繼承來源 DataGridColumn)
HeaderStyle

取得資料行行首區段的樣式屬性。Gets the style properties for the header section of the column.

(繼承來源 DataGridColumn)
HeaderText

取得或設定顯示於資料行行首區段的文字。Gets or sets the text displayed in the header section of the column.

(繼承來源 DataGridColumn)
IsTrackingViewState

取得值,判斷是否標記 DataGridColumn 物件以儲存其狀態。Gets a value that determines whether the DataGridColumn object is marked to save its state.

(繼承來源 DataGridColumn)
ItemStyle

取得資料行項目儲存格的樣式屬性。Gets the style properties for the item cells of the column.

(繼承來源 DataGridColumn)
Owner

取得有資料行做為其中成員的 DataGrid 控制項。Gets the DataGrid control that the column is a member of.

(繼承來源 DataGridColumn)
SortExpression

在選取資料行來排序時,取得或設定欄位或運算式的名稱以傳遞至 OnSortCommand(DataGridSortCommandEventArgs) 方法。Gets or sets the name of the field or expression to pass to the OnSortCommand(DataGridSortCommandEventArgs) method when a column is selected for sorting.

(繼承來源 DataGridColumn)
UpdateText

取得或設定要顯示於 EditCommandColumnUpdate 命令按鈕的文字。Gets or sets the text to display for the Update command button in the EditCommandColumn.

ValidationGroup

取得或設定驗證控制項群組,EditCommandColumn 物件會在回傳至伺服器時,針對這個群組進行驗證。Gets or sets the group of validation controls for which the EditCommandColumn object causes validation when it posts back to the server.

ViewState

取得 StateBag 物件,該物件允許衍生自 DataGridColumn 類別的資料行儲存其屬性。Gets the StateBag object that allows a column derived from the DataGridColumn class to store its properties.

(繼承來源 DataGridColumn)
Visible

取得或設定值,指出資料行是否可見於 DataGrid 控制項中。Gets or sets a value that indicates whether the column is visible in the DataGrid control.

(繼承來源 DataGridColumn)

方法

Equals(Object)

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

(繼承來源 Object)
GetHashCode()

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

(繼承來源 Object)
GetType()

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

(繼承來源 Object)
Initialize()

提供基底實作,以將衍生自 DataGridColumn 類別的資料行重設為其初始狀態。Provides the base implementation to reset a column derived from the DataGridColumn class to its initial state.

(繼承來源 DataGridColumn)
InitializeCell(TableCell, Int32, ListItemType)

初始化資料行中的儲存格。Initializes a cell within the column.

LoadViewState(Object)

載入 DataGridColumn 物件的狀態。Loads the state of the DataGridColumn object.

(繼承來源 DataGridColumn)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
OnColumnChanged()

呼叫 OnColumnsChanged() 方法。Calls the OnColumnsChanged() method.

(繼承來源 DataGridColumn)
SaveViewState()

儲存 DataGridColumn 物件的目前狀態。Saves the current state of the DataGridColumn object.

(繼承來源 DataGridColumn)
ToString()

傳回資料行的字串表示。Returns the string representation of the column.

(繼承來源 DataGridColumn)
TrackViewState()

導致對伺服器控制項的檢視狀態變更的追蹤 (Tracking),以便它們能夠儲存於伺服器控制項的 StateBag 物件。Causes tracking of view-state changes to the server control so they can be stored in the server control's StateBag object.

(繼承來源 DataGridColumn)

明確介面實作

IStateManager.IsTrackingViewState

取得值,指出資料行是否正在追蹤 (Tracking) 檢視狀態變更。Gets a value that indicates whether the column is tracking view state changes.

(繼承來源 DataGridColumn)
IStateManager.LoadViewState(Object)

載入先前儲存的狀態。Loads previously saved state.

(繼承來源 DataGridColumn)
IStateManager.SaveViewState()

傳回包含狀態變更的物件。Returns an object containing state changes.

(繼承來源 DataGridColumn)
IStateManager.TrackViewState()

啟動追蹤狀態的變更。Starts tracking state changes.

(繼承來源 DataGridColumn)

適用於

另請參閱