Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]Welcome to DevExpress .NET Documentation
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
   Getting Started
  [Expand]Reporting
  [Expand]Chart Control
  [Collapse]Grid View
   [Expand]Product Information
    Getting Started
   [Expand]Fundamentals
   [Collapse]Concepts
    [Expand]Binding to Data
    [Collapse]Data Representation Basics
     [Expand]Cells
     [Expand]Columns
     [Collapse]Rows
       Traversing Rows
       Preview
     [Expand]Customization Window
     [Expand]Context Menu Overview
      Customization Dialog
    [Expand]Focus and Navigation
    [Expand]Data Editing
    [Expand]Data Shaping and Manipulation
    [Expand]Data Formatting
    [Expand]Master-Detail Relationship
     Appearance Customization
     Adaptivity
     Save and Restore Layout
    [Expand]Templates
    [Expand]Export
     Toolbars
    [Expand]ASPxGridLookup
    ASPxGridView Designer
   [Expand]Visual Elements
   [Expand]Examples
   [Expand]Member Tables
   [Expand]ASPxGridView - Animated Images
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]Scheduler
  [Expand]HTML Editor
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gauges
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Traversing Rows

This topic describes how to traverse (access one by one) through rows displayed within ASPxGridView. This includes:

  1. Rows Displayed Within the Current Page
  2. Visible Rows
  3. All Data Rows

Expanded Rows Displayed Within the Current Page

ASPxGridView provides two server-side events that fire for each row (data row, group row, etc.) before it is rendered onscreen, and enable you to customize its style, templates, or perform required calculations. These are:

  • ASPxGridView.HtmlRowCreated - this event is raised for each row, displayed within the current page, when the corresponding HTML table row has been created. You can handle this event, for example, to initialize web controls contained within grid templates.
  • ASPxGridView.HtmlRowPrepared - this event is raised for each row, displayed within the current page, when the corresponding HTML table row has been prepared but isn't yet rendered. You can handle this event to change the style settings of individual rows.

Both events provide the same set of parameters that allow you to identify the currently processed row's type, visible index, key value, etc. For an example, please see How to: Dynamically Change Images Displayed Within Data Cells.

Important Note:

ASPxGridView provides the ASPxGridView.GetCurrentPageRowValues method, which returns row values displayed within the current page. The method's parameter allows you to specify data source fields whose values should be returned.

In some instances, however, it is needed to traverse through current page rows one by one. If data is grouped, the current page can contain both data and group rows. To identify whether data grouping is applied, check the number of grouped columns.

Data and group rows displayed within the grid can be identified by their visible indexes. To traverse through the current page rows, you need to obtain the starting and ending visible indices.

Expanded Visible Rows

The number of visible rows is returned by the grid's ASPxGridView.VisibleRowCount property. This includes both data rows and group rows (if data grouping is applied). Data and group rows contained within collapsed groups are not counted. End-users can see the number of visible rows within the grid's Pager.

The following code shows how to traverse through all visible rows one by one.

Expanded All Data Rows

If ASPxGridView displayed all records from the bound data source (data isn't grouped or filtered), you can process all data rows as shown in the Visible Rows section. Otherwise, use methods provided by the data source to access its records one by one.

Is this topic helpful?​​​​​​​