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

ASPxGridView.GetRow(Int32) Method

Returns an object that represents the specified row.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.2.dll

NuGet Package: DevExpress.Web

Declaration

public object GetRow(
    int visibleIndex
)

Parameters

Name Type Description
visibleIndex Int32

An integer value that identifies the row.

Returns

Type Description
Object

An object that represents the specified row.

Remarks

The GetRow 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 GetRow method automatically calls the grid’s 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).

protected string GetIconImageUrl(GridViewDataItemTemplateContainer container) {
    Quote quote = (Quote)grid.GetRow(container.VisibleIndex);
    return String.Format("Images/{0}.gif", quote.Change >= 0 ? "Up" : "Down");
}

Run Demo: ASPxGridView - Live Data

See Also