System.Web 2.0.0.0 System.Web.UI.WebControls.CompositeDataBoundControl System.Web.UI.ICallbackEventHandler System.Web.UI.IPostBackEventHandler System.Web.UI.WebControls.ICallbackContainer System.Web.UI.WebControls.IPostBackContainer System.ComponentModel.DefaultEvent("SelectedIndexChanged") System.Web.UI.ControlValueProperty("SelectedValue") System.ComponentModel.Designer("System.Web.UI.Design.WebControls.GridViewDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner") System.Web.UI.SupportsEventValidation

In this topic:

Introduction

Column Fields

Binding to Data

Data Operations

Customizing the User Interface

Events

Accessibility

Declarative Syntax

## Introduction

The control is used to display the values of a data source in a table. Each column represents a field, while each row represents a record. The control supports the following features:

Binding to data source controls, such as .

Built-in sort capabilities.

Built-in update and delete capabilities.

Built-in paging capabilities.

Built-in row selection capabilities.

Programmatic access to the object model to dynamically set properties, handle events, and so on.

Multiple key fields.

Multiple data fields for the hyperlink columns.

Customizable appearance through themes and styles.

To learn about the other data-bound controls that are available in ASP.NET, see ASP.NET Data-Bound Web Server Controls Overview.

If you are familiar with the control from the .NET Framework version 1.0, the control is the successor to the control.

## Column Fields

Each column in the control is represented by a object. By default, the property is set to true, which creates an object for each field in the data source. Each field is then rendered as a column in the control in the order that each field appears in the data source.

You can also manually control which column fields appear in the control by setting the property to false and then defining your own column field collection. Different column field types determine the behavior of the columns in the control. The following table lists the different column field types that can be used.

Column field type

Description

Displays the value of a field in a data source. This is the default column type of the control.

Displays a command button for each item in the control. This enables you to create a column of custom button controls, such as the Add or the Remove button.

Displays a check box for each item in the control. This column field type is commonly used to display fields with a Boolean value.

Displays predefined command buttons to perform select, edit, or delete operations.

Displays the value of a field in a data source as a hyperlink. This column field type enables you to bind a second field to the hyperlink's URL.

Displays an image for each item in the control.

Displays user-defined content for each item in the control according to a specified template. This column field type enables you to create a custom column field.

To define a column field collection declaratively, first add opening and closing <Columns> tags between the opening and closing tags of the control. Next, list the column fields that you want to include between the opening and closing <Columns> tags. The columns specified are added to the collection in the order listed. The collection stores all the column fields in the control and enables you to programmatically manage the column fields in the control.

Explicitly declared column fields can be displayed in combination with automatically generated column fields. When both are used, explicitly declared column fields are rendered first, followed by the automatically generated column fields.

Automatically generated column fields are not added to the collection.

## Binding to Data

The control can be bound to a data source control (such as the control or control) or to any data source collection that implements the interface, such as , , , or other collection types. Use one of the following methods to bind the control to the appropriate data source type:

To bind to a data source control, set the property of the control to the value of the data source control. The control automatically binds to the specified data source control and can take advantage of the data source control's capabilities to perform sorting, updating, deleting, and paging. This is the preferred method to bind to data.

To bind to a data source that implements the interface, programmatically set the property of the control to the data source and then call the method. When using this method, the control does not provide built-in sort, update, delete, and paging functionality. You need to provide this functionality by using the appropriate event.

For more information about data binding, see Accessing Data with ASP.NET.

This control can be used to display user input, which might include malicious client script. Check any information that is sent from a client for executable script, SQL statements, or other code before displaying it in your application. Whenever possible, it is strongly recommended that values are HTML-encoded before they are displayed in this control (the class HTML-encodes values by default). 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

The control provides many built-in capabilities that allow the user to sort, update, delete, select, and page through items in the control. When the control is bound to a data source control, the control can take advantage of the data source control's capabilities and provide automatic sort, update, and delete functionality.

The control can provide support for sorting, updating, and deleting with other types of data sources. However, you will need to provide an appropriate event handler with the implementation for these operations.

Sorting allows the user to sort the items in the control with respect to a specific column by clicking on the column's header. To enable sorting, set the property to true.

The automatic updating, deleting, and selection functionalities are enabled when a button in a or column field, with a command name of "Edit", "Delete", and "Select", respectively, is clicked. The control can automatically add a column field with an Edit, Delete, or Select button if the , , or property is set to true, respectively.

Inserting records into the data source is not directly supported by the control. However, it is possible to insert records by using the control in conjunction with the DetailsView or FormView control. For more information, see or , respectively.

Instead of displaying all the records in the data source at the same time, the control can automatically break the records up into pages. To enable paging, set the property to true.

The control is re-created on postback based on the information that is stored in . If the control includes a or a with the property set to true, then the property must also be set to true to ensure that concurrent data operations, such as updates and deletes, apply to the appropriate row.

## Customizing the User Interface

You can customize the appearance of the control by setting the style properties for the different parts of the control. The following table lists the different style properties.

Style property

Description

The style settings for the alternating data rows in the control. When this property is set, the data rows are displayed alternating between the settings and the settings.

The style settings for the row being edited in the control.

The style settings for the empty data row displayed in the control when the data source does not contain any records.

The style settings for the footer row of the control.

The style settings for the header row of the control.

The style settings for the pager row of the control.

The style settings for the data rows in the control. When the property is also set, the data rows are displayed alternating between the settings and the settings.

The style settings for the selected row in the control.

The style setting for the data column the data is sorted by in the control. When this style is set, the style (for example, highlighted column) is applied to cells when the data is sorted in ascending order.

The style setting for the data column the data is sorted by in the control. When this style is set, an arrow indicating the data is sorted ascending is placed on the header of the control when the data is sorted in ascending order.

The style setting for the data column the data is sorted by in the control. When this style is set, the style (for example, highlighted column) is applied to cells when the data is sorted in descending order.

The style setting for the data column the data is sorted by in the control. When this style is set, an arrow pointing down is placed on the header of the when the data is sorted in descending order.

You can also show or hide different parts of the control. The following table lists the properties that control which parts are shown or hidden.

Property

Description

Shows or hides the footer section of the control.

Shows or hides the header section of the control.

## Events

The control provides several events that you can program against. This enables you to run a custom routine whenever an event occurs. The following table lists the events that are supported by the control.

Event

Description

Occurs when one of the pager buttons is clicked, but after the control handles the paging operation. This event is commonly used when you need to perform a task after the user navigates to a different page in the control.

Occurs when one of the pager buttons is clicked, but before the control handles the paging operation. This event is often used to cancel the paging operation.

Occurs when a row's Cancel button is clicked, but before the control exits edit mode. This event is often used to stop the canceling operation.

Occurs when a button is clicked in the control. This event is often used to perform a task when a button is clicked in the control.

Occurs when a new row is created in the control. This event is often used to modify the contents of a row when the row is created.

Occurs when a data row is bound to data in the control. This event is often used to modify the contents of a row when the row is bound to data.

Occurs when a row's Delete button is clicked, but after the control deletes the record from the data source. This event is often used to check the results of the delete operation.

Occurs when a row's Delete button is clicked, but before the control deletes the record from the data source. This event is often used to cancel the deleting operation.

Occurs when a row's Edit button is clicked, but before the control enters edit mode. This event is often used to cancel the editing operation.

Occurs when a row's Update button is clicked, but after the control updates the row. This event is often used to check the results of the update operation.

Occurs when a row's Update button is clicked, but before the control updates the row. This event is often used to cancel the updating operation.

Occurs when a row's Select button is clicked, but after the control handles the select operation. This event is often used to perform a task after a row is selected in the control.

Occurs when a row's Select button is clicked, but before the control handles the select operation. This event is often used to cancel the selection operation.

Occurs when the hyperlink to sort a column is clicked, but after the control handles the sort operation. This event is commonly used to perform a task after the user clicks a hyperlink to sort a column.

Occurs when the hyperlink to sort a column is clicked, but before the control handles the sort operation. This event is often used to cancel the sorting operation or to perform a custom sorting routine.

## Accessibility

For information about how to configure this control so that it generates markup that conforms to accessibility standards, see Accessibility in Visual Studio 2010 and ASP.NET 4 and ASP.NET Controls and Accessibility.

## Declarative Syntax

`<asp:GridView AccessKey="string" AllowPaging="True|False" AllowSorting="True|False" AutoGenerateColumns="True|False" AutoGenerateDeleteButton="True|False" AutoGenerateEditButton="True|False" AutoGenerateSelectButton="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" EditIndex="integer" EmptyDataText="string" Enabled="True|False" EnableSortingAndPagingCallbacks="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" ForeColor="color name|#dddddd" GridLines="None|Horizontal|Vertical|Both" 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" OnLoad="Load event handler" OnPageIndexChanged="PageIndexChanged event handler" OnPageIndexChanging="PageIndexChanging event handler" OnPreRender="PreRender event handler" OnRowCancelingEdit="RowCancelingEdit event handler" OnRowCommand="RowCommand event handler" OnRowCreated="RowCreated event handler" OnRowDataBound="RowDataBound event handler" OnRowDeleted="RowDeleted event handler" OnRowDeleting="RowDeleting event handler" OnRowEditing="RowEditing event handler" OnRowUpdated="RowUpdated event handler" OnRowUpdating="RowUpdating event handler" OnSelectedIndexChanged="SelectedIndexChanged event handler" OnSelectedIndexChanging="SelectedIndexChanging event handler" OnSorted="Sorted event handler" OnSorting="Sorting 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" PageSize="integer" RowHeaderColumn="string" runat="server" SelectedIndex="integer" ShowFooter="True|False" ShowHeader="True|False" SkinID="string" Style="string" TabIndex="integer" ToolTip="string" UseAccessibleHeader="True|False" Visible="True|False" Width="size" > <AlternatingRowStyle /> <Columns> <asp:BoundField AccessibleHeaderText="string" ApplyFormatInEditMode="True|False" ConvertEmptyStringToNull="True|False" DataField="string" DataFormatString="string" FooterText="string" HeaderImageUrl="uri" HeaderText="string" HtmlEncode="True|False" InsertVisible="True|False" NullDisplayText="string" ReadOnly="True|False" ShowHeader="True|False" SortExpression="string" Visible="True|False" > <ControlStyle /> <FooterStyle /> <HeaderStyle /> <ItemStyle /> </asp:BoundField> <asp:ButtonField AccessibleHeaderText="string" ButtonType="Button|Image|Link" CausesValidation="True|False" CommandName="string" DataTextField="string" DataTextFormatString="string" FooterText="string" HeaderImageUrl="uri" HeaderText="string" ImageUrl="uri" InsertVisible="True|False" ShowHeader="True|False" SortExpression="string" Text="string" ValidationGroup="string" Visible="True|False" > <ControlStyle /> <FooterStyle /> <HeaderStyle /> <ItemStyle /> </asp:ButtonField> <asp:CheckBoxField AccessibleHeaderText="string" DataField="string" FooterText="string" HeaderImageUrl="uri" HeaderText="string" InsertVisible="True|False" ReadOnly="True|False" ShowHeader="True|False" SortExpression="string" Text="string" Visible="True|False" > <ControlStyle /> <FooterStyle /> <HeaderStyle /> <ItemStyle /> </asp:CheckBoxField> <asp:CommandField AccessibleHeaderText="string" ButtonType="Button|Image|Link" CancelImageUrl="uri" CancelText="string" CausesValidation="True|False" DeleteImageUrl="uri" DeleteText="string" EditImageUrl="uri" EditText="string" FooterText="string" HeaderImageUrl="uri" HeaderText="string" InsertImageUrl="uri" InsertText="string" InsertVisible="True|False" NewImageUrl="uri" NewText="string" SelectImageUrl="uri" SelectText="string" ShowCancelButton="True|False" ShowDeleteButton="True|False" ShowEditButton="True|False" ShowHeader="True|False" ShowInsertButton="True|False" ShowSelectButton="True|False" SortExpression="string" UpdateImageUrl="uri" UpdateText="string" ValidationGroup="string" Visible="True|False" > <ControlStyle /> <FooterStyle /> <HeaderStyle /> <ItemStyle /> </asp:CommandField> <asp:DynamicField AccessibleHeaderText="string" ApplyFormatInEditMode="True|False" ConvertEmptyStringToNull="True|False" DataField="string" DataFormatString="string" FooterText="string" HeaderImageUrl="uri" HeaderText="string" HtmlEncode="True|False" InsertVisible="True|False" NullDisplayText="string" ShowHeader="True|False" UIHint="string" Visible="True|False" > <ControlStyle /> <FooterStyle /> <HeaderStyle /> <ItemStyle /> </asp:DynamicField> <asp:HyperLinkField AccessibleHeaderText="string" DataNavigateUrlFields="string" DataNavigateUrlFormatString="string" DataTextField="string" DataTextFormatString="string" FooterText="string" HeaderImageUrl="uri" HeaderText="string" InsertVisible="True|False" NavigateUrl="uri" ShowHeader="True|False" SortExpression="string" Target="string|_blank|_parent|_search|_self|_top" Text="string" Visible="True|False" > <ControlStyle /> <FooterStyle /> <HeaderStyle /> <ItemStyle /> </asp:HyperLinkField> <asp:ImageField AccessibleHeaderText="string" AlternateText="string" ConvertEmptyStringToNull="True|False" DataAlternateTextField="string" DataAlternateTextFormatString="string" DataImageUrlField="string" DataImageUrlFormatString="string" FooterText="string" HeaderImageUrl="uri" HeaderText="string" InsertVisible="True|False" NullDisplayText="string" NullImageUrl="uri" ReadOnly="True|False" ShowHeader="True|False" SortExpression="string" Visible="True|False" > <ControlStyle /> <FooterStyle /> <HeaderStyle /> <ItemStyle /> </asp:ImageField> <asp:TemplateField AccessibleHeaderText="string" ConvertEmptyStringToNull="True|False" FooterText="string" HeaderImageUrl="uri" HeaderText="string" InsertVisible="True|False" ShowHeader="True|False" SortExpression="string" Visible="True|False" > <ControlStyle /> <FooterStyle /> <HeaderStyle /> <ItemStyle /> <AlternatingItemTemplate> <!-- child controls --> </AlternatingItemTemplate> <EditItemTemplate> <!-- child controls --> </EditItemTemplate> <FooterTemplate> <!-- child controls --> </FooterTemplate> <HeaderTemplate> <!-- child controls --> </HeaderTemplate> <InsertItemTemplate> <!-- child controls --> </InsertItemTemplate> <ItemTemplate> <!-- child controls --> </ItemTemplate> </asp:TemplateField> </Columns> <EditRowStyle /> <EmptyDataRowStyle /> <EmptyDataTemplate> <!-- child controls --> </EmptyDataTemplate> <FooterStyle /> <HeaderStyle /> <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 /> <SelectedRowStyle /> </asp:GridView>`

Displays the values of a data source in a table where each column represents a field and each row represents a record. The control enables you to select, sort, and edit these items.

- Constructor

  Use this constructor to initialize a new instance of the class. To dynamically add a control to a page, create a new object, set its properties, and then add it to the collection of a container control, such as .

  Initializes a new instance of the class.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue(false)
  System.Boolean To be added.

  Instead of displaying all the records in the data source at the same time, the control can automatically break the records up into pages. If the data source supports the paging capability, the control can take advantage of that and provide built-in paging functionality. The paging feature can be used with any data source object that supports the interface or a data source that supports paging capability.

  To enable the paging feature, set the property to true. By default, the control displays 10 records on a page at a time. You can change the number of records displayed on a page by setting the property. To determine the total number of pages required to display the data source contents, use the property. You can determine the index of the currently displayed page by using the property.

  When paging is enabled, an additional row called the pager row is automatically displayed in the control. The pager row contains controls that allow the user to navigate to the other pages. You can control the settings of the pager row (such as the pager display mode, the number of page links to display at a time, and the pager control's text labels) by using the property. The pager row can be displayed at the top, bottom, or both the top and bottom of the control by setting the property. You can also select from one of four built-in pager display modes by setting the property. The following table describes the built-in display modes.

  Mode

  Description

  PagerButton.NextPrevious

  A set of pagination controls consisting of previous and next buttons.

  PagerButton.NextPreviousFirstLast

  A set of pagination controls consisting of previous, next, first, and last buttons.

  PagerButton.Numeric

  A set of pagination controls consisting of numbered link buttons to access pages directly. This is the default mode.

  PagerButton.NumericFirstLast

  A set of pagination controls consisting of numbered and first and last link buttons.

  To control the appearance of the pager row (including its background color, font color, and position), use the property.

  The control automatically hides the pager row when the data source contains only one page of records.

  The control also enables you to define a custom template for the pager row. For more information about creating a custom pager row template, see .

  The control provides several events that you can use to perform a custom action when paging occurs. The following table lists the available events.

  Event

  Description

  Occurs when one of the pager buttons is clicked, but after the control handles the paging operation. This event is commonly used when you need to perform a task after the user navigates to a different page in the control.

  Occurs when one of the pager buttons is clicked, but before the control handles the paging operation. This event is often used to cancel the paging operation.

  Gets or sets a value indicating whether the paging feature is enabled.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue(false)
  System.Boolean To be added.

  When a data source control that supports sorting is bound to the control, the control can take advantage of the data source control's capabilities and provide automatic sorting functionality. When the control is bound to a data source by setting the property programmatically, you must provide the sorting functionality by using the event.

  Different data sources have different requirements for enabling their sorting capabilities. To determine the requirements, see the documentation for the specific data source.

  To enable sorting, set the property to true. When sorting is enabled, the heading text for each column field with its property set is displayed as a link button.

  The property for an automatically generated columns field is automatically populated. If you define your own columns through the collection, you must set the property for each column; otherwise, the column will not display the link button in the header.

  Clicking the link button for a column causes the items in the control to be sorted based on the sort expression. Typically, the sort expression is simply the name of the field displayed in the column, which causes the control to sort with respect to that column. To sort by multiple fields, use a sort expression that contains a comma-separated list of field names. You can determine the sort expression that the control is applying by using the property. Clicking a column's link button repeatedly toggles the sort direction between ascending and descending order. To determine the current sort direction, use the property.

  The control provides several events that you can use to perform a custom action when sorting occurs. The following table lists the available events.

  Event

  Description

  Occurs when the hyperlink to sort a column is clicked, but after the control handles the sort operation. This event is commonly used to perform a task after the user clicks a hyperlink to sort a column.

  Occurs when the hyperlink to sort a column is clicked, but before the control handles the sort operation. This event is often used to cancel the sorting operation or to perform a custom sorting routine.

  Gets or sets a value indicating whether the sorting feature is enabled.

  2.0.0.0
- Property
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)
  System.ComponentModel.NotifyParentProperty(true)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.Web.UI.WebControls.TableItemStyle To be added.

  Use the property to control the appearance of alternating data rows in a control. When this property is set, the data rows are displayed alternating between the settings and the settings. This property is read-only; however, you can set the properties of the object it returns. The properties can be set declaratively using one of the following methods:

  Place an attribute in the opening tag of the control in the form , where is a property of the object (for example, AlternatingRowStyle-ForeColor).

  Nest an <AlternatingRowStyle> element between the opening and closing tags of the control.

  The properties can also be set programmatically in the form (for example, AlternatingRowStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.

  Gets a reference to the object that enables you to set the appearance of alternating data rows in a control.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue(true)
  System.Boolean To be added.

  When the property is set to true, an object is automatically created for each field in the data source. Each field is then displayed as a column in the control in the order that the fields appear in the data source. This option provides a convenient way to display every field in the data source; however, you have limited control of how an automatically generated column field is displayed or behaves.

  Instead of letting the control automatically generate the column fields, you can manually define the column fields by setting the property to false and then creating a custom Columns collection. In addition to bound column fields, you can also display a button column field, a check box column field, a command field, a hyperlink column field, an image field, or a column field based on your own custom-defined template.

  You can also combine explicitly declared column fields with automatically generated column fields. When both are used, explicitly declared column fields are rendered first, followed by the automatically generated column fields. Automatically generated bound column fields are not added to the collection. For more information, see .

  If you set this property to true and set the property to a model type, controls are generated. If you do not set the property, controls are generated. If you do not want controls, you have the following options:

  Set the property to null in the Page_Load event handler. In that case, controls are generated.

  Write custom code to automatically generate fields by creating and assigning your own class and assigning an instance of it to the control.

  Set to false. In that case, no fields are generated, and you must manually specify fields using controls such as or .

  Do not set the property. In that case, controls are generated.

  Gets or sets a value indicating whether bound fields are automatically created for each field in the data source.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue(false)
  System.Boolean To be added.

  When a data source control that supports deleting is bound to a control, the control can take advantage of the data source control's capabilities and provide automatic deleting functionality.

  For a data source control to delete data, it must be configured to delete data. To configure a data source control to delete records, see the documentation for the specific data source control.

  When the property is set to true, a column (represented by a object) with a Delete button for each data row is automatically added to the control. Clicking the Delete button for a row permanently removes that record from the data source.

  You must also set the property to identify the key field or fields of the data source for the automatic deleting feature to work.

  The control provides several events that you can use to perform a custom action when a row is deleted. The following table lists the available events.

  Event

  Description

  Occurs when a row's Delete button is clicked, but after the control deletes the record from the data source. This event is often used to check the results of the delete operation.

  Occurs when a row's Delete button is clicked, but before the control deletes the record from the data source. This event is often used to cancel the deleting operation.

  Gets or sets a value indicating whether a field column with a Delete button for each data row is automatically added to a control.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue(false)
  System.Boolean To be added.

  When a data source control that supports updating is bound to a control, the control can take advantage of the data source control's capabilities and provide automatic updating functionality.

  For a data source control to update data, it must be configured to update data. To configure a data source control to update records, see the documentation for the specific data source control.

  When the property is set to true, a column (represented by a object) with an Edit button for each data row is automatically added to the control. Clicking an Edit button for a row puts that row in edit mode. When a row is in edit mode, each column field in the row that is not read-only displays the appropriate input control, such as a control, for the field's data type. This allows the user to modify the field's value.

  When clicked, the Edit button is also replaced with an Update button and a Cancel button. Clicking the Update button updates the row in the data source with any value changes and returns the row to display mode. Clicking the Cancel button abandons any value changes and returns the row to display mode.

  You can programmatically put a row in edit mode by setting the property with the index of the row. To programmatically exit edit mode, set the property to -1.

  When using the built-in updating functionality, you must set the property with a comma-separated list of field names to identify the primary key field or fields of the data source; otherwise, the built-in updating functionality will not be able to update the correct record. When using automatically generated field columns (by setting the property to true), the control automatically ensures that the automatically generated field columns that correspond to the field or fields specified in the property are read-only.

  You can control the appearance of a row that is in edit mode by using the property. Common settings usually include a custom background color, foreground color, and font properties.

  The control provides several events that you can use to perform a custom action when a row is updated. The following table lists the available events.

  Event

  Description

  Occurs when a row's Cancel button is clicked, but before the control cancels out of edit mode. This event is often used to stop the canceling operation.

  Occurs when a row's Edit button is clicked, but before the control enters edit mode. This event is often used to cancel the editing operation.

  Occurs when a row's Update button is clicked, but after the control updates the row. This event is often used to check the results of the update operation.

  Occurs when a row's Update button is clicked, but before the control updates the row. This event is often used to cancel the updating operation.

  Gets or sets a value indicating whether a field column with an Edit button for each data row is automatically added to a control.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue(false)
  System.Boolean To be added.

  When the property is set to true, a column (represented by a object) with a Select button for each data row is automatically added to the control. Clicking the Select button for a row selects that row in the control, which sets the property to the index of the row. To retrieve the object that represents the selected row, use the property. You can also get the primary key value for the selected record by using the property. The property contains the values of the key fields specified in the property.

  You can programmatically select a row by setting the property. To cancel the selection of a row, set the property to -1.

  You can control the appearance of the selected row by using the property. Common settings usually include a custom background color, foreground color, and font properties.

  The control provides several events that you can use to perform a custom action when a row is selected. The following table lists the available events.

  Event

  Description

  Occurs when a row's Select button is clicked, but after the control handles the select operation. This event is often used to perform a task after a row is selected in the control.

  Occurs when a row's Select button is clicked, but before the control handles the select operation. This event is often used to cancel the selecting operation.

  Gets or sets a value indicating whether a field column with a Select button for each data row is automatically added to a control.

  2.0.0.0
- Property
  System.ComponentModel.Editor("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
  System.ComponentModel.DefaultValue("")
  System.Web.UI.UrlProperty
  System.String To be added.

  Use the property to specify the URL to an image to display in the background of a control.

  If the specified image is smaller than the control, the image is tiled to fill in the background. If the image is larger than the control, the image is cropped.

  Gets or sets the URL to an image to display in the background of a control.

  2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Web.UI.WebControls.GridViewRow To be added.

  When paging is enabled (by setting the property to true), an additional row called the pager row is automatically displayed in the control. The pager row contains controls that allow the user to navigate to the other pages, and can be displayed at the top, the bottom, or both the top and bottom of the control. Use the property to programmatically access the object that represents the bottom pager row in the control.

  The property is available only after the control creates the bottom pager row in the event.

  This property is commonly used when you need to programmatically manipulate the bottom pager row, for example when adding custom content. Any modification to the property must be performed after the control has been rendered; otherwise, the control will overwrite any changes.

  Gets a object that represents the bottom pager row in a control.

  2.0.0.0
- Property
  System.ComponentModel.Localizable(true)
  System.ComponentModel.DefaultValue("")
  System.String To be added.

  Use the property to specify the text to render in an HTML caption element in a control. The text that you specify provides assistive technology devices with a description of the table that can be used to make the control more accessible. You can also specify the position at which to render the HTML caption element by using the property.

  The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see and ASP.NET Globalization and Localization.

  Gets or sets the text to render in an HTML caption element in a control. This property is provided to make the control more accessible to users of assistive technology devices.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue(System.Web.UI.WebControls.TableCaptionAlign.NotSet)
  System.Web.UI.WebControls.TableCaptionAlign To be added.

  Use the property to specify the horizontal or vertical position of the HTML caption element in a control. This property is provided to make the control more accessible to users of assistive technology devices.

  This property is set using one of the enumeration values. The following table lists the possible values.

  Value

  Description

  TableCaptionAlign.Bottom

  The caption element is aligned with the bottom of the table.

  TableCaptionAlign.Left

  The caption element is aligned with the left side of the table.

  TableCaptionAlign.NotSet

  The caption element's alignment is not set.

  TableCaptionAlign.Right

  The caption element is aligned with the right side of the table.

  TableCaptionAlign.Top

  The caption element is aligned with the top of the table.

  When this property is set to TableCaptionAlign.NotSet, the default value of the browser is used.

  To specify the text for the HTML caption element, use the property.

  Gets or sets the horizontal or vertical position of the HTML caption element in a control. This property is provided to make the control more accessible to users of assistive technology devices.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue(-1)
  System.Int32 To be added.

  Use the property to control the spacing between the contents of a cell and the cell's border. The padding amount specified is added to all four sides of the cell.

  All cells in the same column of a control have the same width. The padding amount is applied to the widest cell and all other cells in the column have this cell width. Similarly, all cells in the same row have the same height. The padding amount is applied to the tallest cell in the row and all other cells in the row have this cell height. Individual cell sizes cannot be specified.

  Gets or sets the amount of space between the contents of a cell and the cell's border.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue(0)
  System.Int32 To be added.

  Use the property to control the spacing between adjacent cells in the control. This spacing is applied both vertically and horizontally. The cell spacing is uniform for the entire control. Individual cell spacing between rows or columns cannot be specified.

  If you set this property to a value greater than 0 and then set the property to a value that displays the cell borders, a gap is displayed between the borders of adjacent cells. In this situation, the property controls the size of the gap.

  Gets or sets the amount of space between cells.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue(null)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.ComponentModel.MergableProperty(false)
  System.ComponentModel.Editor("System.Web.UI.Design.WebControls.DataControlFieldTypeEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
  System.Web.UI.WebControls.DataControlFieldCollection To be added.

  A column field represents a column in a control. The property (collection) is used to store all the explicitly declared column fields that get rendered in the control. You can also use the collection to programmatically manage the collection of column fields.

  Explicitly declared column fields can be used in combination with automatically generated column fields. When both are used, explicitly declared column fields are rendered first, followed by the automatically generated column fields. Automatically generated column fields are not added to the collection.

  The column fields are displayed in the control in the order that the column fields appear in the collection. The following table shows the different column field classes that derive from the class and can be used in the collection.

  Column field type

  Description

  Displays the value of a field in a data source. This is the default column type of the control.

  Displays a command button for each item in the control. This enables you to create a column of custom button controls, such as the Add or the Remove button.

  Displays a check box for each item in the control. This column field type is commonly used to display fields with a Boolean value.

  Displays predefined command buttons to perform select, edit, or delete operations.

  Displays the value of a field in a data source as a hyperlink. This column field type enables you to bind a second field to the hyperlink's URL.

  Displays an image for each item in the control.

  Displays user-defined content for each item in the control, according to a specified template. This column field type enables you to create a custom column field.

  Although you can programmatically add column fields to the collection, it is easier to list the column fields declaratively in the control and then use the property of each column field to show or hide each column field.

  If the property of a column field is set to false, the column is not displayed in the control and the data for the column does not make a round trip to the client. If you want the data for a column that is not visible to make a round trip, add the field name to the property.

  Gets a collection of objects that represent the column fields in a control.

  2.0.0.0
- Method
  System.Web.UI.WebControls.AutoGeneratedField ``

  The method is used to create an automatically generated column field when the property is set to true. The properties of the automatically generated column field are specified through the object contained in the parameter.

  This method is used primarily by control developers to extend the control.

  Creates an automatically generated column field.

  An that represents the automatically generated column field specified by the parameter.

  An that represents the properties of the automatically generated column field to create. 2.0.0.0
- Method
  System.Int32 `` `` To be added.

  The method is used to create the control hierarchy of the control.

  This method is used primarily by control developers to extend the control.

  Creates the control hierarchy used to render the control using the specified data source.

  The number of rows created.

  true to indicate that the child controls are bound to data; otherwise, false. 2.0.0.0
- Method
  System.Web.UI.WebControls.Table

  The method is a helper method used by the control to create a child table.

  Creates a new child table.

  Always returns a new that represents the child table.

  2.0.0.0
- Method
  System.Collections.ICollection `` ``

  When the property is set to true, a bound column field is automatically created for each field in the data source. Each bound column field is then displayed as a row in the control in the order that the fields appear in the data source. The method is used to create the automatically generated column fields.

  This method is used primarily by control developers to extend the control.

  Creates the set of column fields used to build the control hierarchy.

  A that contains the fields used to build the control hierarchy.

  A that represents the data source. true to use the data source specified by the parameter; otherwise, false. 2.0.0.0
- Method
  System.Web.UI.WebControls.Style

  The method is used to create the default style for the control.

  This method is used primarily by control developers to extend the control.

  Creates the default style for the control.

  A that represents the style for the control.

  2.0.0.0
- Method
  System.Web.UI.DataSourceSelectArguments

  The method is a helper method called by the control to create the object that contains the arguments passed to the data source. In this implementation, the object contains the arguments for paging operations.

  Creates the object that contains the arguments that get passed to the data source for processing.

  A that contains the arguments that get passed to the data source.

  2.0.0.0
- Method
  System.Web.UI.WebControls.GridViewRow `` `` `` ``

  The method is used to create a row in the control.

  This method is used primarily by control developers to extend the control. A data-bound control automatically generates the rows needed to display the target data.

  Creates a row in the control.

  A created using the specified parameters.

  The index of the row to create. The index of the data source item to bind to the row. One of the values. One of the values. 2.0.0.0
- Method
  System.Void

  Use the method to bind data from a data source to the control. This method resolves all data-binding expressions in the active template of the control.

  The method is called automatically if the property of the control refers to a valid data source control.

  Instead of manually calling the method, you can use model binding with your control by setting the property to the name of a method that returns data for the . The is then automatically populated with the data that is returned from the select method. Model binding can simplify your code for working with data. For more information, see Model Binding and Web Forms.

  Binds the data source to the control. This method cannot be inherited.

  2.0.0.0
- Property
  System.ComponentModel.Editor("System.Web.UI.Design.WebControls.DataFieldEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
  System.ComponentModel.TypeConverter(typeof(System.Web.UI.WebControls.StringArrayConverter))
  System.ComponentModel.DefaultValue(null)
  System.String[] To be added.

  Use the property to specify the field or fields that represent the primary key of the data source. You should only set this property to the field or fields that are required to uniquely identify each row; for example, the ID column if an integer value uniquely identifies each row. You must set the property in order for the automatic update and delete features of the control to work. The values of these key fields are passed to the data source control in order to specify the row to update or delete.

  If you need to retrieve the data key value when updating or deleting a row, use the Keys property of either the or class. For example, e.Keys[0] holds the value of the first data key in a or event handler.

  If you need to retrieve the data key value when a row is selected, use the property.

  When the property is set, the control automatically populates its collection with the values from the specified field or fields, which provides a convenient way to access the primary keys of each row.

  The control stores these key field values in the control state. If these values contain sensitive information, it is strongly recommended that you enable view-state encryption by setting the property to ViewStateEncryptionMode.Always.

  When you use automatically generated field columns (by setting the property to true), the control makes sure that the columns that correspond to the field or fields specified in the property are read-only.

  If the property of a column field is set to false, the column is not displayed in the control and the data for the column does not make a round trip to the client. If you want the data for a column that is not visible to be available to the client, add the field name to the property.

  Gets or sets an array that contains the names of the primary key fields for the items displayed in a control.

  2.0.0.0
- Property
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.Browsable(false)
  System.Web.UI.WebControls.DataKeyArray To be added.

  When the property is set, the control automatically creates a object for each row in the control. The object contains the values of the field or fields specified in the property. The objects are then added to the control's collection. Use the property to retrieve the object for a specific data row in the control.

  You can use the property to retrieve the object for the currently selected row. You can also use the property to retrieve the data key value for the currently selected row directly.

  Gets a collection of objects that represent the data key value of each row in a control.

  2.0.0.0
- Method
  System.Void ``

  Use the method to programmatically delete the record at the specified index from the data source. This method is commonly used when you need to delete a record from outside of the control, such as from a different control on the page. Calling this method also raises the and events.

  Deletes the record at the specified index from the data source.

  The index of the row to delete. 2.0.0.0
- Property
  System.ComponentModel.DefaultValue(-1)
  System.Int32 To be added.

  The row index is zero-based (the first row is row zero).

  This property is typically used only in the following scenarios, which involve handlers for specific events:

  You want the control to open in edit mode for a specific row the first time that the page is displayed. To do this, you can set the property in the handler for the event of the class or of the control.

  You want to know which row was edited after the row was updated. To do this, you can retrieve the row index from the property in the event handler.

  You are binding the control to a data source by setting the property programmatically. In this case you must set the property in the and event handlers.

  If you set the property after a postback or in handlers for events that are raised later than the event, the control might not enter edit mode for the specified row. If you read the value of this property in other event handlers, the index is not guaranteed to reflect the row that is being edited.

  To determine which row the user has clicked an Edit button or hyperlink in before the control enters edit mode, you can retrieve the row index from the property of the object in the event handler.

  To prevent the control from entering edit mode after a user has clicked an Edit button or hyperlink, set the property of the object to true in the event handler.

  Gets or sets the index of the row to edit.

  2.0.0.0
- Property
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)
  System.ComponentModel.NotifyParentProperty(true)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.Web.UI.WebControls.TableItemStyle To be added.

  Use the property to control the appearance of the row being edited in a control. This property is read-only; however, you can set the properties of the object it returns. The properties can be set declaratively using one of the following methods:

  Place an attribute in the opening tag of the control in the form , where is a property of the object (for example, EditRowStyle-ForeColor).

  Nest an <EditRowStyle> element between the opening and closing tags of the control.

  The properties can also be set programmatically in the form (for example, EditRowStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.

  Gets a reference to the object that enables you to set the appearance of the row selected for editing in a control.

  2.0.0.0
- Property
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)
  System.ComponentModel.NotifyParentProperty(true)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.Web.UI.WebControls.TableItemStyle To be added.

  Use the property to control the appearance of the null row in a control. The null row is displayed when the data source that is bound to the control does not contain any records. This property is read-only; however, you can set the properties of the object it returns. The properties can be set declaratively using one of the following methods:

  Place an attribute in the opening tag of the control in the form , where is a property of the object (for example, EmptyDataRowStyle-ForeColor).

  Nest an <EmptyDataRowStyle> element between the opening and closing tags of the control.

  The properties can also be set programmatically in the form (for example, EmptyDataRowStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.

  Gets a reference to the object that enables you to set the appearance of the empty data row rendered when a control is bound to a data source that does not contain any records.

  2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.GridViewRow), System.ComponentModel.BindingDirection.OneWay)
  System.ComponentModel.DefaultValue(null)
  System.Web.UI.ITemplate To be added.

  The empty data row is displayed in a control when the data source that is bound to the control does not contain any records. You can define your own custom user interface (UI) for the empty data row by using the property.

  To specify a custom template for the empty data row, first place <EmptyDataTemplate> tags between the opening and closing tags of the control. You can then list the contents of the template between the opening and closing <EmptyDataTemplate> tags. To control the style of the empty data row, use the property. Alternatively, you can use the built-in UI for the empty data row by setting the property instead of this property.

  For information about how to programmatically access controls that you declare in an empty data template, see How to: Access Server Controls by ID.

  If both the and properties are set, the property takes precedence.

  Gets or sets the user-defined content for the empty data row rendered when a control is bound to a data source that does not contain any records.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue("")
  System.ComponentModel.Localizable(true)
  System.String To be added.

  The empty data row is displayed in a control when the data source that is bound to the control does not contain any records. Use the property to specify the text to display in the empty data row. To control the style of the empty data row, use the property. Alternatively, you can define your own custom user interface (UI) for the empty data row by setting the property instead of this property.

  If both the and properties are set, the property takes precedence.

  The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see and ASP.NET Globalization and Localization.

  Gets or sets the text to display in the empty data row rendered when a control is bound to a data source that does not contain any records.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue(false)
  System.Boolean To be added.

  By default, when a sorting or paging operation is performed, the control posts back to the server to perform the operation. When the property is set to true, a service is called on the client to perform sorting and paging operations, which eliminates the need to post back to the server.

  Not all browsers support this feature. To determine whether a browser supports this feature, use the property.

  All columns in the collection must support callbacks for this feature to work. If the collection contains a column that does not support callbacks, such as , a exception is raised.

  Gets or sets a value indicating whether client-side callbacks are used for sorting and paging operations.

  2.0.0.0
- Method
  System.Void `` `` `` ``

  The method is a helper method called by the control to retrieve the values of each field declared within the row specified by the parameter. You can specify whether the extracted values include read-only fields and key fields by using the and parameters, respectively.

  Retrieves the values of each field declared within the specified row and stores them in the specified object.

  An used to store the field values. The from which to retrieve the field values. true to include read-only fields; otherwise, false. true to include the primary key field or fields; otherwise, false. 2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Web.UI.WebControls.GridViewRow To be added.

  Use the property to programmatically access the object that represents the footer row in a control.

  The property is available only after the control creates the footer row in the event.

  This property is commonly used when you need to programmatically manipulate the footer row, for example when adding custom content. Any modification to the property must be performed after the control has been rendered; otherwise, the control will overwrite any changes.

  Gets a object that represents the footer row in a control.

  2.0.0.0
- Property
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)
  System.ComponentModel.DefaultValue(null)
  System.ComponentModel.NotifyParentProperty(true)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.Web.UI.WebControls.TableItemStyle To be added.

  Use the property to control the appearance of the footer row in a control. This property is read-only; however, you can set the properties of the object it returns. The properties can be set declaratively using one of the following methods:

  Place an attribute in the opening tag of the control in the form , where is a property of the object (for example, FooterStyle-ForeColor).

  Nest a <FooterStyle> element between the opening and closing tags of the control.

  The properties can also be set programmatically in the form (for example, FooterStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.

  Gets a reference to the object that enables you to set the appearance of the footer row in a control.

  2.0.0.0
- Method
  System.String

  The control implements the interface and uses the to asynchronously retrieve data and the method to return the retrieved data to the control.

  Returns the result of a callback event that targets a control.

  The results of the callback.

  2.0.0.0
- Method
  System.String `` `` To be added.

  The method is a helper method used by the control to create the callback script for a button that performs a sorting operation.

  Creates the callback script for a button that performs a sorting operation.

  The callback script for a button that performs a sorting operation.

  The arguments to pass to the callback script. 2.0.0.0
- Property
  System.ComponentModel.DefaultValue(System.Web.UI.WebControls.GridLines.Both)
  System.Web.UI.WebControls.GridLines To be added.

  Use the property to specify the gridline style for a control. The following table lists the available styles.

  Style

  Description

  GridLines.None

  No gridlines are displayed.

  GridLines.Horizontal

  Displays the horizontal gridlines only.

  GridLines.Vertical

  Displays the vertical gridlines only.

  GridLines.Both

  Displays both the horizontal and vertical gridlines.

  Gets or sets the gridline style for a control.

  2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Web.UI.WebControls.GridViewRow To be added.

  Use the property to programmatically access the object that represents the header row in a control.

  The property is available only after the control creates the header row in the event.

  This property is commonly used when you need to programmatically manipulate the header row, for example, when adding custom content. Any modification to the property must be performed after the control has been rendered; otherwise, the control will overwrite any changes.

  Gets a object that represents the header row in a control.

  2.0.0.0
- Property
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)
  System.ComponentModel.DefaultValue(null)
  System.ComponentModel.NotifyParentProperty(true)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.Web.UI.WebControls.TableItemStyle To be added.

  Use the property to control the appearance of the header row in a control. This property is read-only; however, you can set the properties of the object it returns. The properties can be set declaratively using one of the following methods:

  Place an attribute in the opening tag of the control in the form , where is a property of the object (for example, HeaderStyle-ForeColor).

  Nest a <HeaderStyle> element between the opening and closing tags of the control.

  The properties can also be set programmatically in the form (for example, HeaderStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.

  Gets a reference to the object that enables you to set the appearance of the header row in a control.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue(System.Web.UI.WebControls.HorizontalAlign.NotSet)
  System.ComponentModel.Category("Layout")
  System.Web.UI.WebControls.HorizontalAlign To be added.

  Use the property to specify the horizontal alignment of a control within the page. The following table lists the different horizontal alignment styles.

  Alignment value

  Description

  HorizontalAlign.NotSet

  The horizontal alignment of the control has not been set.

  HorizontalAlign.Left

  The control is left-aligned on the page.

  HorizontalAlign.Center

  The control is centered on the page.

  HorizontalAlign.Right

  The control is right-aligned on the page.

  HorizontalAlign.Justify

  The control is aligned with both the left and right margins of the page.

  Gets or sets the horizontal alignment of a control on the page.

  2.0.0.0
- Method
  System.Void `` `` `` To be added.

  The method is used to initialize the pager row displayed when the paging feature is enabled.

  This method is used primarily by control developers to extend the control.

  Initializes the pager row displayed when the paging feature is enabled.

  A that represents the pager row to initialize. The number of columns the pager row should span. 2.0.0.0
- Method
  System.Void `` ``

  The method is used to initialize a row in the control.

  This method is used primarily by control developers to extend the control.

  Initializes a row in the control.

  A that represents the row to initialize. An array of objects that represent the column fields in the control. 2.0.0.0
- Method
  System.Boolean ``

  The method is a helper method that is commonly used by control developers to programmatically determine whether the specified data type can be bound to a column in a control. The following data types can be bound to a column in a control:

  Determines whether the specified data type can be bound to a column in a control.

  true if the specified data type can be bound to a column in a control; otherwise, false.

  A that represents the data type to test. 2.0.0.0
- Method
  2.0.0.0
  System.Void `` To be added.

  This method is used to load the state of the properties in the control that need to be persisted, even when the property is set to false.

  This method is used primarily by control developers to extend the control.

  Loads the state of the properties in the control that need to be persisted, even when the property is set to false.

- Method
  System.Void ``

  This method is used primarily by the .NET Framework infrastructure and is not intended to be used directly from your code. However, control developers can override this method to specify how a custom server control restores its view state. For more information, see ASP.NET State Management Overview.

  Loads the previously saved view state of the control.

  An that contains the saved view state values for the control. 2.0.0.0
- Method
  System.Boolean `` ``

  The method implements the method to pass events from child controls to the page hierarchy.

  Determines whether the event for the Web server control is passed up the page's user interface (UI) server control hierarchy.

  true if the event has been canceled; otherwise, false.

  The source of the event. An that contains event data. 2.0.0.0
- Method
  System.Void

  The method is a helper method used by the control to rebind the control to its data after the , , or property is changed.

  Rebinds the control to its data after the , , or property is changed.

  2.0.0.0
- Method
  System.Void `` ``

  The method notifies a control that the underlying data source has changed and that the control should rebind. Typically, the method is called when a property of the data source view has changed.

  Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event.

  The source of the event. An that contains the event data. 2.0.0.0
- Method
  2.0.0.0
  System.Void ``

  When notified by this method, Web server controls must perform any initialization steps that are required to create and set up an instance. In this stage of the server control's life cycle, the control's View state has yet to be populated. Additionally, you cannot access other server controls when this method is called, regardless of whether it is a child or parent to this control. Other server controls are not guaranteed to be created and ready for access.

  Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event.

  An that contains event data.
- Method
  System.Void ``

  The event is raised when one of the pager buttons is clicked, but after the control handles the paging operation. This enables you to provide an event-handling method that performs a custom routine, such as a custom paging operation, whenever this event occurs.

  Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event.

  An that contains event data. 2.0.0.0
- Method
  System.Void ``

  The event is raised when one of the pager buttons is clicked, but before the control handles the paging operation. This enables you to provide an event-handling method that performs a custom routine, such as canceling the paging operation, whenever this event occurs.

  Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event.

  A that contains event data. 2.0.0.0
- Method
  System.Void `` `` To be added.

  Sets the initialized state of the data-bound control before the control is loaded.

  The source of the event. An that contains the event data. 2.0.0.0
- Method
  2.0.0.0
  System.Void ``

  This method notifies the server control to perform any necessary pre-rendering steps prior to saving view state and rendering content.

  Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event.

  An that contains the event data.
- Method
  System.Void ``

  The event is raised when the Cancel button of a row in edit mode is clicked, but before the row exits edit mode. This enables you to provide an event-handling method that performs a custom routine, such as stopping the cancel operation if it would put the row in an undesired state, whenever this event occurs.

  Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event.

  A that contains event data. 2.0.0.0
- Method
  System.Void ``

  The event is raised when a button is clicked in the control. This enables you to provide an event-handling method that performs a custom routine whenever this event occurs.

  Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event.

  A that contains event data. 2.0.0.0
- Method
  System.Void ``

  Before the control can be rendered, a object must be created for each row in the control. The event is raised when each row in the control is created. This enables you to provide an event-handling method that performs a custom routine, such as adding custom content to a row, whenever this event occurs.

  Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event.

  A that contains event data. 2.0.0.0
- Method
  System.Void ``

  Before the control can be rendered, each row in the control must be bound to a record in the data source. The event is raised when a data row (represented by a object) is bound to data in the control. This enables you to provide an event-handling method that performs a custom routine, such as modifying the values of the data bound to the row, whenever this event occurs.

  Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  A Visual Studio Web site project with source code is available to accompany this topic: Download.

  Raises the event.

  A that contains event data. 2.0.0.0
- Method
  System.Void ``

  The event is raised when a row's Delete button is clicked, but after the control deletes the row. This enables you to provide an event-handling method that performs a custom routine, such as checking the results of the delete operation, whenever this event occurs.

  Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event.

  A that contains event data. 2.0.0.0
- Method
  System.Void ``

  The event is raised when a row's Delete button is clicked, but before the control deletes the row. This enables you to provide an event-handling method that performs a custom routine, such as canceling the delete operation, whenever this event occurs.

  Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event.

  A that contains event data. 2.0.0.0
- Method
  System.Void ``

  The event is raised when a row's Edit button is clicked, but before the control enters edit mode. This enables you to provide an event-handling method that performs a custom routine, such as canceling the edit operation, whenever this event occurs.

  Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event.

  A that contains event data. 2.0.0.0
- Method
  System.Void ``

  The event is raised when a row's Update button is clicked, but after the control updates the row. This enables you to provide an event-handling method that performs a custom routine, such as checking the results of the update operation, whenever this event occurs.

  Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event.

  A that contains event data. 2.0.0.0
- Method
  System.Void ``

  The event is raised when a row's Update button is clicked, but before the control updates the row. This enables you to provide an event-handling method that performs a custom routine, such as canceling the update operation, whenever this event occurs.

  Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event.

  A that contains event data. 2.0.0.0
- Method
  System.Void ``

  The event is raised when a row's Select button is clicked, but after the control handles the select operation. This enables you to provide an event-handling method that performs a custom routine, such as updating a status label with the currently selected row, whenever this event occurs.

  Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event.

  An that contains event data. 2.0.0.0
- Method
  System.Void ``

  The event is raised when a row's Select button is clicked, but before the control handles the select operation. This enables you to provide an event-handling method that performs a custom routine, such as canceling the selection operation, whenever this event occurs.

  Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event.

  A that contains event data. 2.0.0.0
- Method
  System.Void ``

  The event is raised when the hyperlink to sort a column is clicked, but after the control handles the sort operation. This enables you to provide an event-handling method that performs a custom routine, such as custom sorting, whenever this event occurs.

  Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event.

  An that contains event data. 2.0.0.0
- Method
  System.Void ``

  The event is raised when the hyperlink to sort a column is clicked, but before the control handles the sort operation. This enables you to provide an event-handling method that performs a custom routine, such as canceling the sorting operation, whenever this event occurs.

  Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event.

  A that contains event data. 2.0.0.0
- Property
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.Browsable(false)
  System.Int32 To be added.

  When the paging feature is enabled (by setting the property to true), use the property to determine the total number of pages required to display the records in the data source. This value is calculated by dividing the total number of records in the data source by the number of records displayed in a page (as specified by the property) and rounding up.

  Gets the number of pages required to display the records of the data source in a control.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue(0)
  System.ComponentModel.Browsable(true)
  System.Int32 To be added.

  When the paging feature is enabled (by setting the property to true), use the property to determine the index of the currently displayed page. You can also use this property to programmatically change the displayed page.

  Gets or sets the index of the currently displayed page.

  2.0.0.0
- Event
  System.EventHandler

  The event is raised when one of the pager buttons is clicked, but after the control handles the paging operation. This enables you to provide an event-handling method that performs a custom routine, such as a custom paging operation, whenever this event occurs.

  To determine the index of the page selected by the user, use the property of the control.

  For more information about handling events, see Consuming Events.

  Occurs when one of the pager buttons is clicked, but after the control handles the paging operation.

  2.0.0.0
- Event
  System.Web.UI.WebControls.GridViewPageEventHandler

  The event is raised when one of the pager buttons is clicked, but before the control handles the paging operation. This enables you to provide an event-handling method that performs a custom routine, such as canceling the paging operation, whenever this event occurs.

  This event is not raised when you programmatically set the property.

  A object is passed to the event-handling method, which enables you to determine the index of the page selected by the user and to indicate that the paging operation should be canceled. To cancel the paging operation, set the property of the object to true.

  For more information about handling events, see Consuming Events.

  Occurs when one of the pager buttons is clicked, but before the control handles the paging operation.

  2.0.0.0
- Property
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.ComponentModel.NotifyParentProperty(true)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)
  System.Web.UI.WebControls.PagerSettings To be added.

  Use the property to control the settings of the pager row in a control. The pager row is displayed when the paging feature is enabled (by setting the property to true) and contains the controls that allow the user to navigate to the different pages in the control. This property is read-only; however, you can set the properties of the object it returns. The properties can be set declaratively using one of the following methods:

  Place an attribute in the opening tag of the control in the form , where is a property of the object (for example, PagerSettings-Mode).

  Nest a <PagerSettings> element between the opening and closing tags of the control.

  The properties can also be set programmatically in the form (for example, PagerStyle.Mode). Common settings usually include the pager row's display mode and custom text or images for the navigation controls.

  Gets a reference to the object that enables you to set the properties of the pager buttons in a control.

  2.0.0.0
- Property
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)
  System.ComponentModel.NotifyParentProperty(true)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.Web.UI.WebControls.TableItemStyle To be added.

  Use the property to control the appearance of the pager row in a control. The pager row is displayed when the paging feature is enabled (by setting the property to true) and contains the controls that allow the user to navigate to the different pages in the control. This property is read-only; however, you can set the properties of the object it returns. The properties can be set declaratively using one of the following methods:

  Place an attribute in the opening tag of the control in the form , where is a property of the object (for example, PagerStyle-ForeColor).

  Nest a <PagerStyle> element between the opening and closing tags of the control.

  The properties can also be set programmatically in the form (for example, PagerStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.

  Gets a reference to the object that enables you to set the appearance of the pager row in a control.

  2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.ComponentModel.DefaultValue(null)
  System.Web.UI.ITemplate To be added.

  A pager row is displayed in a control when the paging feature is enabled (when the property is set to true). The pager row contains the controls that allow the user to navigate to the different pages in the control. Instead of using the built-in pager row user interface (UI), you can define your own UI by using the property.

  When the property is set, it overrides the built-in pager row UI.

  To specify a custom template for the pager row, first place <PagerTemplate> tags between the opening and closing tags of the control. You can then list the contents of the template between the opening and closing <PagerTemplate> tags. To control the appearance of the pager row, use the property.

  Typically, button controls are added to the pager template to perform the paging operations. The control performs a paging operation when a button control with its CommandName property set to "Page" is clicked. The button's CommandArgument property determines the type of paging operation to perform. The following table lists the command argument values supported by the control.

  value

  Description

  "Next"

  Navigates to the next page.

  "Prev"

  Navigates to the previous page.

  "First"

  Navigates to the first page.

  "Last"

  Navigates to the last page.

  Integer value

  Navigates to the specified page number.

  Gets or sets the custom content for the pager row in a control.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue(10)
  System.Int32 To be added.

  When the paging feature is enabled (by setting the property to true), use the property to specify the number of records to display on a single page.

  Gets or sets the number of records to display on a page in a control.

  2.0.0.0
- Method
  2.0.0.0
  System.Void ``

  The method is a helper method called by the control to bind the specified data source to the control.

  Binds the specified data source to the control.

  An that contains the data source.
- Method
  2.0.0.0
  System.Void

  This method is used to establish the control hierarchy for the control.

  This method is used primarily by control developers to extend the control.

  Establishes the control hierarchy.

- Method
  System.Void `` To be added.

  The method is a helper method used by the control to create the arguments for the callback handler in the method.

  Creates the arguments for the callback handler in the method.

  2.0.0.0
- Method
  System.Void ``

  The page calls the method when a postback event occurs that raises the appropriate events for a control. This call occurs in the page life cycle after loading and change notification are complete, but before prerendering occurs. This method has been implemented to create a object for the events that are raised.

  This method is used primarily by control developers to extend the control.

  Raises the appropriate events for the control when it posts back to the server.

  The event argument from which to create a for the event or events that are raised. 2.0.0.0
- Method
  2.0.0.0
  System.Void ``

  The method is used to render the server control content to the client's browser using the specified object.

  This method is used primarily by control developers to extend the control.

  Renders the Web server control content to the client's browser using the specified object.

  The used to render the server control content on the client's browser.
- Event
  System.Web.UI.WebControls.GridViewCancelEditEventHandler

  The event is raised when the Cancel button of a row in edit mode is clicked, but before the row exits edit mode. This enables you to provide an event-handling method that performs a custom routine, such as stopping the cancel operation if it would put the row in an undesired state, whenever this event occurs.

  A object is passed to the event-handling method, which enables you to determine the index of the current row and to indicate that the cancel operation should be stopped. To stop the cancel operation, set the property of the object to true.

  For more information about handling events, see Consuming Events.

  Occurs when the Cancel button of a row in edit mode is clicked, but before the row exits edit mode.

  2.0.0.0
- Event
  System.Web.UI.WebControls.GridViewCommandEventHandler

  The event is raised when a button is clicked in the control. This enables you to provide an event-handling method that performs a custom routine whenever this event occurs.

  Buttons within a control can also invoke some of the built-in functionality of the control. To perform one of these operations, set the CommandName property of a button to one of the values in the following table.

  value

  Description

  "Cancel"

  Cancels an edit operation and returns the control to read-only mode. Raises the event.

  "Delete"

  Deletes the current record. Raises the and events.

  "Edit"

  Puts the current record in edit mode. Raises the event.

  "Page"

  Performs a paging operation. Sets the CommandArgument property of the button to "First", "Last", "Next", "Prev", or a page number to specify the type of paging operation to perform. Raises the and events.

  "Select"

  Selects the current record. Raises the and events.

  "Sort"

  Sorts the control. Raises the and events.

  "Update"

  Updates the current record in the data source. Raises the and events.

  Although the event is raised when a button listed in the previous table is clicked, it is recommended that you use the events listed in the table for the operation.

  A object is passed to the event-handling method, which enables you to determine the command name and command argument of the button clicked.

  To determine the index of the row that raised the event, use the property of the event argument that is passed to the event. The class automatically populates the property with the appropriate index value. For other command buttons, you must manually set the property of the command button. For example, you can set the to <%# Container.DataItemIndex %> when the control has no paging enabled.

  For more information about handling events, see Consuming Events.

  Occurs when a button is clicked in a control.

  2.0.0.0
- Event
  System.Web.UI.WebControls.GridViewRowEventHandler

  Before the control can be rendered, a object must be created for each row in the control. The event is raised when each row in the control is created. This enables you to provide an event-handling method that performs a custom routine, such as adding custom content to a row, whenever this event occurs.

  A object is passed to the event-handling method, which enables you to access the properties of the row being created. To access a specific cell in the row, use the property of the object. You can determine which row type (header row, data row, and so on) is being created by using the property.

  For more information about handling events, see Consuming Events.

  Occurs when a row is created in a control.

  2.0.0.0
- Event
  System.Web.UI.WebControls.GridViewRowEventHandler

  Before the control can be rendered, each row in the control must be bound to a record in the data source. The event is raised when a data row (represented by a object) is bound to data in the control. This enables you to provide an event-handling method that performs a custom routine, such as modifying the values of the data bound to the row, whenever this event occurs.

  A object is passed to the event-handling method, which enables you to access the properties of the row being bound. To access a specific cell in the row, use the property of the object contained in the property of the object. You can determine which row type (header row, data row, and so on) is being bound by using the property.

  For more information about handling events, see Consuming Events.

  Occurs when a data row is bound to data in a control.

  2.0.0.0
- Event
  System.Web.UI.WebControls.GridViewDeletedEventHandler

  The event is raised when a row's Delete button is clicked, but after the control deletes the row. This enables you to provide an event-handling method that performs a custom routine, such as checking the results of the delete operation, whenever this event occurs.

  A object is passed to the event-handling method, which enables you to determine the number of rows affected and any exceptions that might have occurred. You can also indicate whether the exception was handled in the event-handling method by setting the property of the object.

  For more information about handling events, see Consuming Events.

  Occurs when a row's Delete button is clicked, but after the control deletes the row.

  2.0.0.0
- Event
  System.Web.UI.WebControls.GridViewDeleteEventHandler

  The event is raised when a row's Delete button is clicked, but before the control deletes the row. This enables you to provide an event-handling method that performs a custom routine, such as canceling the delete operation, whenever this event occurs.

  A object is passed to the event-handling method, which enables you to determine the index of the current row and to indicate that the delete operation should be canceled. To cancel the delete operation, set the property of the object to true. You can also manipulate the and collections, if necessary, before the values are passed to the data source.

  For more information about handling events, see Consuming Events.

  Occurs when a row's Delete button is clicked, but before the control deletes the row.

  2.0.0.0
- Event
  System.Web.UI.WebControls.GridViewEditEventHandler

  The event is raised when a row's Edit button is clicked, but before the control enters edit mode. This enables you to provide an event-handling method that performs a custom routine, such as canceling the edit operation, whenever this event occurs.

  A object is passed to the event-handling method, which enables you to determine the index of the current row and to indicate that the edit operation should be canceled. To cancel the edit operation, set the property of the object to true.

  For more information about handling events, see Consuming Events.

  Occurs when a row's Edit button is clicked, but before the control enters edit mode.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue("")
  System.String To be added.

  In HTML, the header of a table can be associated with either a row or a column. The direction is specified by setting the scope attribute of the <th> elements. The control has a built-in header row that can be displayed by setting the property to true. You can also optionally specify a header column (usually the first or last column in the control) by setting this property. When this property is set, all cells in the column that corresponds to the specified field name are rendered as <th scope="row"> elements.

  Although the specified column is treated like a header, the , , and properties do not apply to the header column.

  The default rendering of the <th> element is preserved, rendering text as bold and centered horizontally. Developers can override the behavior of the <th> element using a cascading style sheet.

  This property works only with bound fields. It does not work with template fields.

  Gets or sets the name of the column to use as the column header for the control. This property is provided to make the control more accessible to users of assistive technology devices.

  2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Web.UI.WebControls.GridViewRowCollection To be added.

  The property (collection) is used to store the data rows in a control. The control automatically populates the collection by creating a object for each record in the data source and then adding each object to the collection. This property is commonly used to access a specific row in the control or to iterate though the entire collection of rows.

  Only rows with their property set to DataControlRowType.DataRow are stored in the collection. The objects that represent the header, footer, and pager rows are not included in the collection.

  Gets a collection of objects that represent the data rows in a control.

  2.0.0.0
- Property
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)
  System.ComponentModel.NotifyParentProperty(true)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.Web.UI.WebControls.TableItemStyle To be added.

  Use the property to control the appearance of the data rows in a control. When the property is also set, the data rows are displayed alternating between the settings and the settings. This property is read-only; however, you can set the properties of the object it returns. The properties can be set declaratively using one of the following methods:

  Place an attribute in the opening tag of the control in the form , where is a property of the object (for example, RowStyle-ForeColor).

  Nest a <RowStyle> element between the opening and closing tags of the control.

  The properties can also be set programmatically in the form (for example, RowStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.

  Gets a reference to the object that enables you to set the appearance of the data rows in a control.

  2.0.0.0
- Event
  System.Web.UI.WebControls.GridViewUpdatedEventHandler

  The event is raised when a row's Update button is clicked, but after the control updates the row. This enables you to provide an event-handling method that performs a custom routine, such as checking the results of the update operation, whenever this event occurs.

  A object is passed to the event-handling method, which enables you to determine the number of rows affected and any exceptions that might have occurred. You can also indicate whether the exception was handled in the event-handling method by setting the property of the object.

  For more information about handling events, see Consuming Events.

  Occurs when a row's Update button is clicked, but after the control updates the row.

  2.0.0.0
- Event
  System.Web.UI.WebControls.GridViewUpdateEventHandler

  The event is raised when a row's Update button is clicked, but before the control updates the row. This enables you to provide an event-handling method that performs a custom routine, such as canceling the update operation, whenever this event occurs.

  A object is passed to the event-handling method, which enables you to determine the index of the current row and to indicate that the update operation should be canceled. To cancel the update operation, set the property of the object to true. You can also manipulate the , , and collections, if necessary, before the values are passed to the data source. A common way to use these collections is to HTML-encode the values supplied by the user before they are stored in the data source. This helps to prevent script injection attacks.

  The , and collections are automatically populated only when the control is bound to data by using the property.

  For more information about handling events, see Consuming Events.

  Occurs when a row's Update button is clicked, but before the control updates the row.

  2.0.0.0
- Method
  2.0.0.0
  System.Object

  This method is used to save the state of the properties in the control that need to be persisted, even when the property is set to false.

  This method is used primarily by control developers to extend the control.

  Saves the state of the properties in the control that need to be persisted, even when the property is set to false.

  Returns the server control's current view state. If there is no view state associated with the control, this method returns null.

- Method
  System.Object To be added.

  Loads the previously saved view state of the control.

  A that contains the saved view state values for the control.

  2.0.0.0
- Property
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.Browsable(false)
  System.Web.UI.WebControls.DataKey To be added.

  When the property is set, the control automatically creates a object for each row in the control using the value or values of the specified field or fields. The objects are then added to the control's collection. Normally, the property is used to retrieve the object for a specific data row in the control. However, if you just need to retrieve the object of the currently selected row, you can simply use the property as a shortcut.

  This is the same as retrieving the object at the index specified by the property from the collection. You can also use the property to retrieve the data key value for the currently selected row directly.

  If you are creating a object and want to access a key field other than the first field, use the indexed property in the property of the object. An example is shown below.

  Gets the object that contains the data key value for the selected row in a control.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue(-1)
  System.ComponentModel.Bindable(true)
  System.Int32 To be added.

  Use the property to determine the index of the currently selected row in a control. You can also use this property to programmatically select a row in the control. To clear the selection of a row, set this property to -1. The appearance of the currently selected row can be customized by using the property. To access the currently selected row, use the property.

  Gets or sets the index of the selected row in a control.

  2.0.0.0
- Event
  System.EventHandler

  The event is raised when a row's Select button is clicked, but after the control handles the select operation. This enables you to provide an event-handling method that performs a custom routine, such as updating a status label with the currently selected row, whenever this event occurs.

  For more information about handling events, see Consuming Events.

  Occurs when a row's Select button is clicked, but after the control handles the select operation.

  2.0.0.0
- Event
  System.Web.UI.WebControls.GridViewSelectEventHandler

  The event is raised when a row's Select button is clicked, but before the control handles the select operation. This enables you to provide an event-handling method that performs a custom routine, such as canceling the selection operation, whenever this event occurs.

  This event is not raised when you programmatically set the property.

  A object is passed to the event-handling method, which enables you to determine the index of the row selected by the user and to indicate that the selection operation should be canceled. To cancel the selection operation, set the property of the object to true.

  For more information about handling events, see Consuming Events.

  Occurs when a row's Select button is clicked, but before the control handles the select operation.

  2.0.0.0
- Property
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.Browsable(false)
  System.Web.UI.WebControls.GridViewRow To be added.

  When a row is selected in a control, use the property to retrieve the object that represents that row.

  This is the same as retrieving the object at the index specified by the property from the collection.

  This object can then be used to access the properties of the selected row.

  Gets a reference to a object that represents the selected row in the control.

  2.0.0.0
- Property
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)
  System.ComponentModel.NotifyParentProperty(true)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.Web.UI.WebControls.TableItemStyle To be added.

  Use the property to control the appearance of the selected row in a control. This property is read-only; however, you can set the properties of the object it returns. The properties can be set declaratively using one of the following methods:

  Place an attribute in the opening tag of the control in the form , where is a property of the object (for example, SelectedRowStyle-ForeColor).

  Nest a <SelectedRowStyle> element between the opening and closing tags of the control.

  The properties can also be set programmatically in the form (for example, SelectedRowStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.

  Gets a reference to the object that enables you to set the appearance of the selected row in a control.

  2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.Object To be added.

  When the property is set with a comma-separated list of field names that represent the primary key of the data source, the control automatically creates a object for each row in the control using the value or values of the specified field or fields. The objects are then added to the control's collection. Normally, the property is used to retrieve the object for a specific data row in the control. However, if you just need to retrieve the object of the currently selected row, you can simply use the property as a shortcut. As a further shortcut, you can directly determine the data key value of the first key field of the selected row by using the property.

  If you are creating a object and want to access a key field other than the first field, use the property. For an example, see .

  Gets the data key value of the selected row in a control.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue(false)
  System.Boolean To be added.

  Use the property to specify whether a control displays the footer row. To control the appearance of the footer row, use the property.

  Gets or sets a value indicating whether the footer row is displayed in a control.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue(true)
  System.Boolean To be added.

  Use the property to specify whether a control displays the header row. To control the appearance of the header row, use the property.

  Gets or sets a value indicating whether the header row is displayed in a control.

  2.0.0.0
- Method
  System.Void `` `` To be added. To be added.

  Use the method to programmatically sort the control using the specified sort expression and direction. The sort expression specifies the column or columns with which to sort. To sort multiple columns, create a sort expression that contains a comma-separated list of field names. The sort direction indicates whether sorting is performed in ascending or descending order. This method is commonly used when you need to sort the control from outside of the control, such as from a different control on the page. This method is also commonly used to programmatically set a default sort order for the control when it is first rendered. Calling this method also raises the and events.

  Sorts the control based on the specified sort expression and direction.

  2.0.0.0
- Property
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.DefaultValue(System.Web.UI.WebControls.SortDirection.Ascending)
  System.ComponentModel.Browsable(false)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)
  System.Web.UI.WebControls.SortDirection To be added.

  Use the property to determine whether the column being sorted is sorted in ascending or descending order.

  The control has a built-in sorting feature that automatically sets this property. This property is typically used only when you need to programmatically determine the sort direction or when you are adding your own custom sorting functionality to a control.

  Gets the sort direction of the column being sorted.

  2.0.0.0
- Event
  System.EventHandler

  The event is raised when the hyperlink to sort a column is clicked, but after the control handles the sort operation. This enables you to provide an event-handling method that performs a custom routine, such as custom sorting, whenever this event occurs.

  For more information about handling events, see Consuming Events.

  Occurs when the hyperlink to sort a column is clicked, but after the control handles the sort operation.

  2.0.0.0
- Property
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.Browsable(false)
  System.String To be added.

  Use the property to determine the sort expression associated with the column or columns being sorted.

  The control has a built-in sorting feature that automatically sets this property. This property is typically used only when you need to programmatically determine the column or columns being sorted or when you are adding your own custom sorting functionality to a control.

  When multiple columns are sorted, this property contains a comma-separated list of the fields by which to sort.

  Gets the sort expression associated with the column or columns being sorted.

  2.0.0.0
- Event
  System.Web.UI.WebControls.GridViewSortEventHandler

  The event is raised when the hyperlink to sort a column is clicked, but before the control handles the sort operation. This enables you to provide an event-handling method that performs a custom routine, such as canceling the sorting operation, whenever this event occurs.

  A object is passed to the event-handling method, which enables you to determine the sort expression for the column and to indicate that the selection operation should be canceled. To cancel the selection operation, set the property of the object to true.

  For information about how to programmatically initiate a sort operation, see the method.

  For more information about handling events, see Consuming Events.

  Occurs when the hyperlink to sort a column is clicked, but before the control handles the sort operation.

  2.0.0.0
- Method
  2.0.0.0
  System.String

  The control implements the interface and uses the to asynchronously retrieve data and the method to return the retrieved data to the control.

  Returns the result of a callback event that targets a control.

  The results of the callback.

- Method
  2.0.0.0
  System.Void `` To be added.

  is a helper method that is used by the control to create the arguments for the callback handler in the method.

  Creates the arguments for the callback handler in the method.

- Method
  2.0.0.0
  System.Void ``

  The page calls the method when a postback event occurs to raise the appropriate events for a control. This call occurs in the page life cycle after loading and change notification are complete, but before prerendering occurs. This method has been implemented to create a object for the event or events that are raised.

  This method is used primarily by control developers to extend the control.

  Raises the appropriate events for the control when it posts back to the server.

  The event argument from which to create a for the event or events that are raised.
- Method
  2.0.0.0
  System.String `` `` To be added.

  is a helper method that is used by the control to create the callback script for a button that performs a sorting operation.

  Creates the callback script for a button that performs a sorting operation.

  The callback script for a button that performs a sorting operation.

  The arguments to pass to the callback script.
- Method
  2.0.0.0
  System.Web.UI.PostBackOptions `` To be added. To be added.

  Creates a object that represents the postback behavior of the specified button control.

  A that represents the postback behavior of the specified button control.

- Property
  System.Web.UI.HtmlTextWriterTag To be added.

  The property allows the output stream to write the appropriate HTML markup for the control. When the property is set to true, this property returns HtmlTextWriterTag.Div; otherwise, this property returns HtmlTextWriterTag.Table.

  Gets the value for the control.

  2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Web.UI.WebControls.GridViewRow To be added.

  When paging is enabled (by setting the property to true), an additional row called the pager row is automatically displayed in the control. The pager row contains controls that allow the user to navigate to the other pages and can be displayed at the top, the bottom, or both the top and bottom of the control. Use the property to programmatically access the object that represents the top pager row in a control.

  The property is available only after the control creates the top pager row in the event.

  This property is commonly used when you need to programmatically manipulate the top pager row, for example when adding custom content. Any modification to the property must be performed after the control has been rendered; otherwise, the control will overwrite any changes.

  Gets a object that represents the top pager row in a control.

  2.0.0.0
- Method
  System.Void

  This method is overridden to mark the starting point at which to begin tracking and saving changes to the control as part of the control's view state.

  Tracks view-state changes to the control so they can be stored in the control's object. This object is accessible through the property.

  2.0.0.0
- Method
  System.Void `` ``

  Use the method to programmatically update the record at the specified index in the data source. This method is commonly used when you need to update a record from outside of the control, such as from a different control on the page.

  This method can be called only for the row that is currently in edit mode, or for a row that contains a two-way data-bound input control. For more information about two-way binding expressions, see ASP.NET Data Binding.

  To specify whether page validation is performed before the update operation, use the parameter. Calling this method also raises the and events.

  Updates the record at the specified row index using the field values of the row.

  The index of the row to update. true to perform page validation when this method is called; otherwise, false. 2.0.0.0
- Property
  System.ComponentModel.DefaultValue(true)
  System.Boolean To be added.

  Use the property to specify whether the control renders its header row in an accessible format. This property is provided to make the control more accessible to users of assistive technology devices. By default, the value of this property is true and the header for the control is rendered using <th> table header cell tags. In addition, a scope="col" attribute is added to the table header to specify that the header applies to all the cells in the column. The default rendering of the <th> element is preserved, rendering text as bold and centered horizontally. Developers can override the style of the <th> element using a cascading style sheet.

  If the value of this property is false, the header for the control is rendered using <td> table cell tags.

  Gets or sets a value indicating whether a control renders its header in an accessible format. This property is provided to make the control more accessible to users of assistive technology devices.

  2.0.0.0