我已经使用转发器来处理来自数据库的绑定数据。我使用寻呼机方法列出数据。当页面开始首先工作时无论如何。我可以转到下一页,但其他页面我无法看到它。刷新页面时我可以看到页面和下一个页面。例如,第一页是1,第二页是2,第三页是3,第四页是4。当第1页工作时,我只能看到下一页。如果我看到1,我可以看到3或4或2但只有一个。 我想有序地显示所有页面。 我该怎么解决这个问题。 这是我的代码:
magazaBUS = new MagazaBUS();
try
{
int magazacount = 0;
if (DropDownList1.SelectedValue != "")
{
magazacount = magazaBUS.MagazaCountGrp(DropDownList1.SelectedValue);
}
else
{
magazacount = magazaBUS.MagazaCount();
}
LblToplamData.Text = " " + magazacount.ToString() + "Kayıt";
if (magazacount > 0)
{
try
{
TotalPage = Math.Ceiling(double.Parse(magazacount.ToString()) / Varibles.CurrentDataDetay);
TotalBar = Math.Ceiling(double.Parse(TotalPage.ToString()) / CurrentBar);
DataTable dtTotalPage = new DataTable();
dtTotalPage.Columns.Add("PageNumber", typeof(string));
if (TotalBar >= PageBar)
{
if (PageBar == TotalBar)
{
for (int i = ((PageBar - 1) * CurrentBar) + 1; i <= ((PageBar - 1) * CurrentBar) + (TotalPage % CurrentBar); i++)
{
dtTotalPage.Rows.Add(i.ToString());
}
}
else
{
for (int i = ((PageBar - 1) * CurrentBar) + 1; i <= (PageBar * CurrentBar); i++)
{
dtTotalPage.Rows.Add(i.ToString());
}
}
}
rptPages.DataSource = dtTotalPage;
rptPages.DataBind();
if (dtTotalPage.Rows.Count >= 1)
pager.Visible = true;
else pager.Visible = false;
}
catch
{
}
}
int baslangic = (PageNumber * Varibles.CurrentDataDetay) + 1;
int bitis = (PageNumber * Varibles.CurrentDataDetay) + Varibles.CurrentDataDetay;
if (DropDownList1.SelectedValue != "")
{
baslangic = (PageNumber * Varibles.CurrentDataDetay) + 1;
bitis = (PageNumber * Varibles.CurrentDataDetay) + Varibles.CurrentDataDetay;
List<MagazaVO> main = magazaBUS.MagazaListeGrp(baslangic - 1, bitis,DropDownList1.SelectedValue);
RptList.DataSource = main;
RptList.DataBind();
}
else
{
baslangic = (PageNumber * Varibles.CurrentDataDetay) + 1;
bitis = (PageNumber * Varibles.CurrentDataDetay) + Varibles.CurrentDataDetay;
List<MagazaVO> main = magazaBUS.MagazaListe(baslangic - 1, bitis);
RptList.DataSource = main;
RptList.DataBind();
}
}
catch
{
}