Skip to content

DevExpress-Examples/asp-net-web-forms-grid-add-numbers-to-rows

Repository files navigation

Grid View for ASP.NET Web Forms - How to add numbers to grid rows

This example demonstrates how to add row numbers (display row visible indices) in a grid.

Implementation Details

  1. Create an unbound column.
<dxwgv:GridViewDataTextColumn Caption="#" UnboundType="String" />
  1. Handle the CustomColumnDisplayText event to assign row visible indices to cell values in the unbound column.
protected void ASPxGridView1_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridViewColumnDisplayTextEventArgs e) {
    if (e.Column.Caption == "#") {
        e.DisplayText = e.VisibleRowIndex.ToString();
    }
}

Files to Review

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)