Search code examples
model-view-controllerwebgrid

how to make mvc 4 webgrid serial number continuous?


How to make the row number of the different pages continuous starting the first page up to the end page ??

creating continuous row number !


Solution

  • I had faced such problem but solved already.
    
    you have to make the index of the row number as follows;
    declare a variable int rowVal=0; 
    
    grid.Column(header: "Serial_No", format: item => rowVal = rowVal + 1 + (grid.RowsPerPage * grid.PageIndex)),
    
     - 
    
    *
    
    > (grid.RowsPerPage * grid.PageIndex) ==>  calculates the offset of the row index of the page number
    -----------------------------------
    
    -----------------------------------