Row Number In Row Header Column

5 posts, 1 answers
  1. Imran
    Imran avatar
    2 posts
    Member since:
    Jul 2012

    Posted 11 Jul 2012 Link to this post

    I need code in vb.net to show row number in the row header column of a gridview
  2. Answer
    Nikolay
    Admin
    Nikolay avatar
    1805 posts

    Posted 16 Jul 2012 Link to this post

    Hi Imran,

    In order to show row numbers in the row header, you should handle the ViewCellFormatting event and set the text of the row header cells to be equal to the RowIndex of the respective rows:

    Private Sub radGridView1_ViewCellFormatting(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.CellFormattingEventArgs) Handles RadGridView1.ViewCellFormatting
        If TypeOf e.CellElement Is GridRowHeaderCellElement Then
            e.CellElement.Text = e.CellElement.RowIndex.ToString()
        End If
    End Sub

    I hope this helps.

    Regards,
    Nikolay
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  3. Imran
    Imran avatar
    2 posts
    Member since:
    Jul 2012

    Posted 17 Jul 2012 Link to this post

    It worked.... thank you
  4. Aseman
    Aseman avatar
    38 posts
    Member since:
    Aug 2019

    Posted 02 Sep 2019 in reply to Nikolay Link to this post

    hi nikolay

    thank you for your answer

    but i`ve  another problem with this code

    row index is reset per page in radgridview and this is not a good event

    please help me

  5. Nadya
    Admin
    Nadya avatar
    172 posts

    Posted 03 Sep 2019 Link to this post

    Hello Aseman,

    Your question has already been answered in the other thread you have opened on the same topic. Please, see our answer there for more information.

    We kindly ask you to use just one thread for a specific problem to contact us. Posting the same questions numerous times slows down our response time because we will need to review and address two or more tickets instead of one. Moreover, threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket, which would be handled before a forum thread.

    Thank you for your understanding. 

    Regards,
    Nadya
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top