Repeater Paging
<p>I am using the following code for paging inside a repeater. I have the paging size set to 3. If there are exactly 3 speech bubbles - the next button is displayed and when I selected I'm redirected to an empty page. However, if there are 4 sepeech bubbles, everything is fine. Is there a way to make sure that if the page size is 3 - no buttons are displayed? Thanks!</p>

<pre><code>    PagedDataSource pagedData = new PagedDataSource();
    pagedData.DataSource = ds.Tables[0].DefaultView;
    pagedData.AllowPaging = true;
    pagedData.PageSize = 3;
    pagedData.CurrentPageIndex = pageNum;

    Repeater1.DataSource = pagedData;
    Repeater1.DataBind();

    cmd.Connection.Close();
    cmd.Connection.Dispose();

    if (pageNum == 0)
    {

        btnPrev.Visible = false;

    }
    if (pageNum &gt;= Math.Floor((decimal)ds.Tables[0].Rows.Count / 3))
    {

        btnNext.Visible = false;
    }

}

protected void btnNext_Click(object sender, EventArgs e)
{
    // Redirects to next page
    Response.Redirect("negativestorydetail.aspx?guid=" + id + "&amp;name=" + name + "&amp;role=" + company_role + "&amp;member=" + mem_id + "&amp;company=" + co_id + "&amp;project=" + proj_name + "&amp;proj_id=" + proj_id + "&amp;tag=" + tag + "&amp;page=" + Convert.ToString(pageNum + 1));
}
protected void btnPrev_Click(object sender, EventArgs e)
{
    // Redirects to previous page
    Response.Redirect("negativestorydetail.aspx?guid=" + id + "&amp;name=" + name + "&amp;role=" + company_role + "&amp;member=" + mem_id + "&amp;company=" + co_id + "&amp;project=" + proj_name + "&amp;proj_id=" + proj_id + "&amp;tag=" + tag + "&amp;page=" + Convert.ToString(pageNum - 1));
}
</code></pre>
