I am working on developing custom pager control to my grid view.
I am using the following syntax to get no of pages:
dblpagecount = (doble)(totrecords / grdPages.PageSize);
pagecount = (int)Math.Ceiling(dblPagecount);
Using above syntax , if the no of records is 41 and page size is 5 then I am getting pagecount as 8 which should be 9.
If I use the below syntax,
double dblPagecount = (double)((decimal)totrecords /grdPages.PageSize);
pagecount = (int)Math.Ceiling(dblPagecount);
I am getting exact page count i.e 9
I got the desired result , but unable to understand why the above synatax is not giving desired results.
When I debugged in first case, I observed that dblpagecount is getting result as 8.0 insted of 8.2
Can any one please clarify , how the above statements works ?