This example demonstrates how to add row numbers (display row visible indices) in a grid.
- Create an unbound column.
<dxwgv:GridViewDataTextColumn Caption="#" UnboundType="String" />
- 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();
}
}
- Default.aspx (VB: Default.aspx)
- Default.aspx.cs (VB: Default.aspx.vb)
(you will be redirected to DevExpress.com to submit your response)