IndexOutOfRangeException
IndexOutOfRangeException: Index -10 is either negative or above rows count.
Error type and the contents are self-explanatory in themselves. You are trying to use/access certain index which does not exists for a given collection object.
A simple use of DEBUGGER should easily help you out. Just look around the code line where you get this error and correct the logic that is trying to access the index which does not exist.
Details on the same:
IndexOutOfRangeException Class[
^]
This surely would help:
Troubleshooting Exceptions: System.IndexOutOfRangeException[
^]
BTW, just by looking from naked eyes, start from here:
objPage.DataSource = dstAllPosts.Tables[0].DefaultView;
objPage.PageSize = 10;
objPage.CurrentPageIndex = currentPage;
Error says -10 kinda thing. Looks like nothing was returned and yet you try to set it to some pagination. Check for number of records returned before setting up the pagination and counts.