I am trying to calculate the number of pages in a repeater based on the records returned and page size, but am having issue with decimals and rounding off. e.g.
iRecordCount = 18;
iPageSize = 10;
// Get total pages
decimal dPageRecords = Convert.ToDecimal(iRecordCount / iPageSize);
iTotalPages = Convert.ToInt32(System.Math.Round(dPageRecords));
Trace.Warn("dPageRecords=" + dPageRecords.ToString());
Trace.Warn("iTotalPages=" + iTotalPages);
Output I'm looking for is:
Whereas I keep fricking getting:
Any ideas thanks?