Problem
The problem is when you have
PageIndex
defined in
DataGrid
, then the number of rows per page will be rendered in HTML client-side.
So, you will never get all the rows in the
DataGrid
.
Solution
You need to loop through the
DataSource
, from which you get the data.
It may be
DataTable
or
DataSet
.
Because at the time of Binding the data, it retrieves all the rows, but when you give
PageIndex
, it only shows the defined number of rows.
So, catch the
DataTable
in JavaScript and try to loop through that.
Refer -
How to loop through all items in the grid when paging property for grid is set[
^] for this concept.
But I found some links where they have done the same way as you did.
Please check what they are doing exactly.
1.
Use javascript to loop through all rows of a paging gridview[
^].
2.
Loop through datagrid in javascript?[
^].
Thanks...