GridView RowHeader SeriaNumber

2 posts, 1 answers
  1. Kashif
    Kashif avatar
    66 posts
    Member since:
    Jan 2019

    Posted 04 Oct Link to this post

    Hi Admins.

    I'm using the following code to show the Serial Number on the RowHeaderColumn.

    private void GridViewSaleItems_ViewCellFormatting(object sender, CellFormattingEventArgs e)
    {
        if (e.CellElement is GridRowHeaderCellElement && e.Row is GridViewDataRowInfo)
        {
            e.CellElement.Text = (e.CellElement.RowIndex + 1).ToString();
            e.CellElement.TextImageRelation = TextImageRelation.ImageBeforeText;
        }
    }

     

    How can I Get this Serial Number (Like other Cell Values) When saving the Grid Rows

  2. Answer
    Nadya
    Admin
    Nadya avatar
    106 posts

    Posted 07 Oct Link to this post

    Hello Kashif,

    You can use the following code snippet to get the value from the GridRowHeaderCellElement:

    private void RadGridView1_CellClick(object sender, GridViewCellEventArgs e)
    {
        int value = e.RowIndex + 1;
        RadMessageBox.Show(value.ToString());
    }

    I hope this helps. Should you have further questions, I would be glad to help.

    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