try this example...
SqlCommand selectCommand = new SqlCommand("SELECT COUNT(*) FROM tablename", thisConnection);
DataSet DsDrpLd = new DataSet();
if (DsDrpLd.Tables[0].Rows.Count > 0)
{
DsDrpLd.ReadXml(MapPath("../Report.xml"));
PagedDataSource objPds = new PagedDataSource();
objPds.DataSource = DsDrpLd.Tables[0].DefaultView;
objPds.AllowPaging = true;
objPds.PageSize = 20;
objPds.CurrentPageIndex = CurrentPage;
lblCurrentPage.Text = "Page : " + (CurrentPage + 1).ToString() + " of " + objPds.PageCount.ToString();
totalcount = Convert.ToInt32(objPds.PageCount.ToString());
lblRecords.Text = Convert.ToString(DsDrpLd.Tables[0].Rows.Count);
}