We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Need GDBG column to display dataset row number

Is there any way to display the row number of the dataset rows displayed, in a column of the grid?

1 Reply

AD Administrator Syncfusion Team June 4, 2003 08:40 AM UTC

If you do not mind losing the record indicator (triangle marking the current row), you can just set a couple of properties to get these numbers shown. Dim style As GridStyleInfo = Me.GridDataBoundGrid1.BaseStylesMap("Row Header").StyleInfo style.CellType = "Header" style.Font.Bold = False Me.GridDataBoundGrid1.Model.Options.NumberedRowHeaders = True If you want to see the numbers on the headers other than the current cell, and see the marker on the current row, then you can use the PrepareViewStyleInfo event for this.
Private Sub GridDataBoundGrid1_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs) Handles GridDataBoundGrid1.PrepareViewStyleInfo
        If e.ColIndex = 0 And e.RowIndex <> Me.GridDataBoundGrid1.CurrentCell.RowIndex Then
            e.Style.CellType = "Header"
            e.Style.Font.Bold = False
        End If
    End Sub
If you want to see both the numbers and the marker in the same cell, one way would be to set the properties as above, then handle the CellDrawn event (only in 1.6 or later), and in this event if it is the current row's header cell, just draw the triangle your self.

Live Chat Icon For mobile
Up arrow icon