This is a migrated thread and some comments may be shown as answers.

GridView RowHeader SeriaNumber

1 Answer 62 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kashif
Top achievements
Rank 1
Kashif asked on 04 Oct 2019, 06:24 PM

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

1 Answer, 1 is accepted

Sort by
0
Accepted
Nadya | Tech Support Engineer
Telerik team
answered on 07 Oct 2019, 03:34 PM

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.
Tags
GridView
Asked by
Kashif
Top achievements
Rank 1
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or