System.Web.UI.WebControls.GridView Members

The members of System.Web.UI.WebControls.GridView are listed below.

See Also: Inherited members from System.Web.UI.WebControls.CompositeDataBoundControl

Public Constructors

Initializes a new instance of the System.Web.UI.WebControls.GridView class.

Public Properties

AllowPagingbool.

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

AllowSortingbool.

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

[read-only]
AlternatingRowStyleTableItemStyle.

Gets a reference to the System.Web.UI.WebControls.TableItemStyle object that enables you to set the appearance of alternating data rows in a System.Web.UI.WebControls.GridView control.

AutoGenerateColumnsbool.

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

AutoGenerateDeleteButtonbool.

Gets or sets a value indicating whether a System.Web.UI.WebControls.CommandField field column with a Delete button for each data row is automatically added to a System.Web.UI.WebControls.GridView control.

AutoGenerateEditButtonbool.

Gets or sets a value indicating whether a System.Web.UI.WebControls.CommandField field column with an Edit button for each data row is automatically added to a System.Web.UI.WebControls.GridView control.

AutoGenerateSelectButtonbool.

Gets or sets a value indicating whether a System.Web.UI.WebControls.CommandField field column with a Select button for each data row is automatically added to a System.Web.UI.WebControls.GridView control.

BackImageUrlstring.

Gets or sets the URL to an image to display in the background of a System.Web.UI.WebControls.GridView control.

[read-only]
BottomPagerRowGridViewRow.

Gets a System.Web.UI.WebControls.GridViewRow object that represents the bottom pager row in a System.Web.UI.WebControls.GridView control.

Captionstring.

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

CaptionAlignTableCaptionAlign.

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

CellPaddingint.

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

CellSpacingint.

Gets or sets the amount of space between cells.

[read-only]
ColumnsDataControlFieldCollection.

Gets a collection of System.Web.UI.WebControls.DataControlField objects that represent the column fields in a System.Web.UI.WebControls.GridView control.

DataKeyNamesstring[].

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

[read-only]
DataKeysDataKeyArray.

Gets a collection of System.Web.UI.WebControls.DataKey objects that represent the data key value of each row in a System.Web.UI.WebControls.GridView control.

EditIndexint.

Gets or sets the index of the row to edit.

[read-only]
EditRowStyleTableItemStyle.

Gets a reference to the System.Web.UI.WebControls.TableItemStyle object that enables you to set the appearance of the row selected for editing in a System.Web.UI.WebControls.GridView control.

[read-only]
EmptyDataRowStyleTableItemStyle.

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

EmptyDataTemplateSystem.Web.UI.ITemplate.

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

EmptyDataTextstring.

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

EnableSortingAndPagingCallbacksbool.

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

[read-only]
FooterRowGridViewRow.

Gets a System.Web.UI.WebControls.GridViewRow object that represents the footer row in a System.Web.UI.WebControls.GridView control.

[read-only]
FooterStyleTableItemStyle.

Gets a reference to the System.Web.UI.WebControls.TableItemStyle object that enables you to set the appearance of the footer row in a System.Web.UI.WebControls.GridView control.

GridLinesGridLines.

Gets or sets the gridline style for a System.Web.UI.WebControls.GridView control.

[read-only]
HeaderRowGridViewRow.

Gets a System.Web.UI.WebControls.GridViewRow object that represents the header row in a System.Web.UI.WebControls.GridView control.

[read-only]
HeaderStyleTableItemStyle.

Gets a reference to the System.Web.UI.WebControls.TableItemStyle object that enables you to set the appearance of the header row in a System.Web.UI.WebControls.GridView control.

HorizontalAlignHorizontalAlign.

Gets or sets the horizontal alignment of a System.Web.UI.WebControls.GridView control on the page.

[read-only]
PageCountint.

Gets the number of pages required to display the records of the data source in a System.Web.UI.WebControls.GridView control.

PageIndexint.

Gets or sets the index of the currently displayed page.

[read-only]
PagerSettingsPagerSettings.

Gets a reference to the System.Web.UI.WebControls.PagerSettings object that enables you to set the properties of the pager buttons in a System.Web.UI.WebControls.GridView control.

[read-only]
PagerStyleTableItemStyle.

Gets a reference to the System.Web.UI.WebControls.TableItemStyle object that enables you to set the appearance of the pager row in a System.Web.UI.WebControls.GridView control.

PagerTemplateSystem.Web.UI.ITemplate.

Gets or sets the custom content for the pager row in a System.Web.UI.WebControls.GridView control.

PageSizeint.

Gets or sets the number of records to display on a page in a System.Web.UI.WebControls.GridView control.

RowHeaderColumnstring.

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

[read-only]
RowsGridViewRowCollection.

Gets a collection of System.Web.UI.WebControls.GridViewRow objects that represent the data rows in a System.Web.UI.WebControls.GridView control.

[read-only]
RowStyleTableItemStyle.

Gets a reference to the System.Web.UI.WebControls.TableItemStyle object that enables you to set the appearance of the data rows in a System.Web.UI.WebControls.GridView control.

[read-only]
SelectedDataKeyDataKey.

Gets the System.Web.UI.WebControls.DataKey object that contains the data key value for the selected row in a System.Web.UI.WebControls.GridView control.

SelectedIndexint.

Gets or sets the index of the selected row in a System.Web.UI.WebControls.GridView control.

[read-only]
SelectedRowGridViewRow.

Gets a reference to a System.Web.UI.WebControls.GridViewRow object that represents the selected row in the control.

[read-only]
SelectedRowStyleTableItemStyle.

Gets a reference to the System.Web.UI.WebControls.TableItemStyle object that enables you to set the appearance of the selected row in a System.Web.UI.WebControls.GridView control.

[read-only]
SelectedValueobject.

Gets the data key value of the selected row in a System.Web.UI.WebControls.GridView control.

ShowFooterbool.

Gets or sets a value indicating whether the footer row is displayed in a System.Web.UI.WebControls.GridView control.

ShowHeaderbool.

Gets or sets a value indicating whether the header row is displayed in a System.Web.UI.WebControls.GridView control.

[read-only]
SortDirectionSortDirection.

Gets the sort direction of the column being sorted.

[read-only]
SortExpressionstring.

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

[read-only]
TopPagerRowGridViewRow.

Gets a System.Web.UI.WebControls.GridViewRow object that represents the top pager row in a System.Web.UI.WebControls.GridView control.

UseAccessibleHeaderbool.

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

Protected Properties

Public Methods

override
DataBind()

Binds the data source to the System.Web.UI.WebControls.GridView control. This method cannot be inherited.

DeleteRow(int)

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

IsBindableType(Type) : bool

Determines whether the specified data type can be bound to a column in a System.Web.UI.WebControls.GridView control.

Sort(string, SortDirection)

Sorts the System.Web.UI.WebControls.GridView control based on the specified sort expression and direction.

UpdateRow(int, bool)

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

Protected Methods

CreateAutoGeneratedColumn(AutoGeneratedFieldProperties) : AutoGeneratedField

Creates an automatically generated column field.

override
CreateChildControls(IEnumerable, bool) : int

Creates the control hierarchy used to render the System.Web.UI.WebControls.GridView control using the specified data source.

CreateChildTable() : Table

Creates a new child table.

CreateColumns(PagedDataSource, bool) : ICollection

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

override
CreateControlStyle() : Style

Creates the default style for the control.

override
CreateDataSourceSelectArguments() : System.Web.UI.DataSourceSelectArguments

Creates the System.Web.UI.DataSourceSelectArguments object that contains the arguments that get passed to the data source for processing.

CreateRow(int, int, DataControlRowType, DataControlRowState) : GridViewRow

Creates a row in the System.Web.UI.WebControls.GridView control.

ExtractRowValues(System.Collections.Specialized.IOrderedDictionary, GridViewRow, bool, bool)

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

GetCallbackResult() : string

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

GetCallbackScript(IButtonControl, string) : string

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

InitializePager(GridViewRow, int, PagedDataSource)

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

InitializeRow(GridViewRow, DataControlField[])

Initializes a row in the System.Web.UI.WebControls.GridView control.

override
LoadControlState(object)

Loads the state of the properties in the System.Web.UI.WebControls.GridView control that need to be persisted, even when the System.Web.UI.Control.EnableViewState property is set to false.

override
LoadViewState(object)

Loads the previously saved view state of the System.Web.UI.WebControls.GridView control.

override
OnBubbleEvent(object, EventArgs) : bool

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

override
OnDataPropertyChanged()

Rebinds the System.Web.UI.WebControls.GridView control to its data after the DataBoundControl.DataMember, BaseDataBoundControl.DataSource, or DataBoundControl.DataSourceID property is changed.

override
OnDataSourceViewChanged(object, EventArgs)

Raises the System.Web.UI.DataSourceView.DataSourceViewChanged event.

override
OnInit(EventArgs)

Raises the System.Web.UI.Control.Init event.

OnPageIndexChanged(EventArgs)

Raises the GridView.PageIndexChanged event.

OnPageIndexChanging(GridViewPageEventArgs)

Raises the GridView.PageIndexChanging event.

override
OnPagePreLoad(object, EventArgs)

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

override
OnPreRender(EventArgs)

Raises the System.Web.UI.Control.PreRender event.

OnRowCancelingEdit(GridViewCancelEditEventArgs)

Raises the GridView.RowCancelingEdit event.

OnRowCommand(GridViewCommandEventArgs)

Raises the GridView.RowCommand event.

OnRowCreated(GridViewRowEventArgs)

Raises the GridView.RowCreated event.

OnRowDataBound(GridViewRowEventArgs)

Raises the GridView.RowDataBound event.

OnRowDeleted(GridViewDeletedEventArgs)

Raises the GridView.RowDeleted event.

OnRowDeleting(GridViewDeleteEventArgs)

Raises the GridView.RowDeleting event.

OnRowEditing(GridViewEditEventArgs)

Raises the GridView.RowEditing event.

OnRowUpdated(GridViewUpdatedEventArgs)

Raises the GridView.RowUpdated event.

OnRowUpdating(GridViewUpdateEventArgs)

Raises the GridView.RowUpdating event.

OnSelectedIndexChanged(EventArgs)

Raises the GridView.SelectedIndexChanged event.

OnSelectedIndexChanging(GridViewSelectEventArgs)

Raises the GridView.SelectedIndexChanging event.

OnSorted(EventArgs)

Raises the GridView.Sorted event.

OnSorting(GridViewSortEventArgs)

Raises the GridView.Sorting event.

override
PerformDataBinding(IEnumerable)

Binds the specified data source to the System.Web.UI.WebControls.GridView control.

PrepareControlHierarchy()

Establishes the control hierarchy.

RaiseCallbackEvent(string)

Creates the arguments for the callback handler in the System.Web.UI.ClientScriptManager.GetCallbackEventReference(System.Web.UI.Control, string, string, string, bool) method.

RaisePostBackEvent(string)

Raises the appropriate events for the System.Web.UI.WebControls.GridView control when it posts back to the server.

override
Render(System.Web.UI.HtmlTextWriter)

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

override
SaveControlState() : object

Saves the state of the properties in the System.Web.UI.WebControls.GridView control that need to be persisted, even when the System.Web.UI.Control.EnableViewState property is set to false.

override
SaveViewState() : object

Loads the previously saved view state of the System.Web.UI.WebControls.GridView control.

override
TrackViewState()

Tracks view-state changes to the System.Web.UI.WebControls.GridView control so they can be stored in the control's System.Web.UI.StateBag object. This object is accessible through the System.Web.UI.Control.ViewState property.

Public Events

PageIndexChanged

Occurs when one of the pager buttons is clicked, but after the System.Web.UI.WebControls.GridView control handles the paging operation.

PageIndexChanging

Occurs when one of the pager buttons is clicked, but before the System.Web.UI.WebControls.GridView control handles the paging operation.

RowCancelingEdit

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

RowCommand

Occurs when a button is clicked in a System.Web.UI.WebControls.GridView control.

RowCreated

Occurs when a row is created in a System.Web.UI.WebControls.GridView control.

RowDataBound

Occurs when a data row is bound to data in a System.Web.UI.WebControls.GridView control.

RowDeleted

Occurs when a row's Delete button is clicked, but after the System.Web.UI.WebControls.GridView control deletes the row.

RowDeleting

Occurs when a row's Delete button is clicked, but before the System.Web.UI.WebControls.GridView control deletes the row.

RowEditing

Occurs when a row's Edit button is clicked, but before the System.Web.UI.WebControls.GridView control enters edit mode.

RowUpdated

Occurs when a row's Update button is clicked, but after the System.Web.UI.WebControls.GridView control updates the row.

RowUpdating

Occurs when a row's Update button is clicked, but before the System.Web.UI.WebControls.GridView control updates the row.

SelectedIndexChanged

Occurs when a row's Select button is clicked, but after the System.Web.UI.WebControls.GridView control handles the select operation.

SelectedIndexChanging

Occurs when a row's Select button is clicked, but before the System.Web.UI.WebControls.GridView control handles the select operation.

Sorted

Occurs when the hyperlink to sort a column is clicked, but after the System.Web.UI.WebControls.GridView control handles the sort operation.

Sorting

Occurs when the hyperlink to sort a column is clicked, but before the System.Web.UI.WebControls.GridView control handles the sort operation.

Explicitly Implemented Interface Members

System.Web.UI.ICallbackEventHandler.GetCallbackResult

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

System.Web.UI.WebControls.ICallbackContainer.GetCallbackScript

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

System.Web.UI.WebControls.IPostBackContainer.GetPostBackOptions

Creates a System.Web.UI.PostBackOptions object that represents the postback behavior of the specified button control.

System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent

Creates the arguments for the callback handler in the System.Web.UI.ClientScriptManager.GetCallbackEventReference(System.Web.UI.Control, string, string, string, bool) method.

System.Web.UI.IPostBackEventHandler.RaisePostBackEvent

Raises the appropriate events for the System.Web.UI.WebControls.GridView control when it posts back to the server.