Skip to main content
A newer version of this page is available. .
Tab

ASPxGridView.GetDataRow(Int32) Method

Returns a DataRow object that represents the specified row.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.2.dll

NuGet Package: DevExpress.Web

Declaration

public DataRow GetDataRow(
    int visibleIndex
)

Parameters

Name Type Description
visibleIndex Int32

An integer value that identifies the row.

Returns

Type Description
DataRow

A DataRow object that represents the specified row. null (Nothing in Visual Basic) if the specified row was not found.

Remarks

The GetDataRow method returns an object that represents a record in a data source. To do this, the ASPxGridView must be bound to a data source. Otherwise, if the grid isn’t bound, the GetDataRow method automatically calls the ASPxWebControl.DataBind method.

In some instances, for example, when handling the ASPxGridView.HtmlRowCreated or ASPxGridView.HtmlRowPrepared event, forcing the data binding can reset values entered by an end-user into editors contained within templates. To avoid this, you should disable the grid’s ASPxGridView.EnableRowsCache option or bind the grid when the page is being initialized or loaded (within the Page_Init or Page_Load event handlers).

Note

Since the GetDataRow method returns a DataRow object, it requires the bound data source support this type of object (e.g. Access Data Source, SQL Data Source). If the bound data source does not support DataRow objects, the GetDataRow method returns null (Nothing in Visual Basic). In this case, you can use the ASPxGridView.GetRow method to get an object that represents the specified row.

The following code snippets (auto-collected from DevExpress Examples) contain references to the GetDataRow(Int32) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also