Repeater paging problem

V

Viktor Popov

Hi,

I'm trying to do the following but I can't understand what's wrong. Could
you help me here!
I do paging with a Repeater like this:

DataSet ds = new DataSet();
dad.Fill(ds, "MyOffers");
if(ds.Tables[0].Rows.Count==0)
Delete.Enabled=false;

PagedDataSource objPds = new PagedDataSource();
objPds.DataSource = ds.Tables[0].DefaultView;
objPds.AllowPaging = true;
objPds.PageSize = 14;
int CurPage;
int FirstPage=1;
int LastPage=objPds.PageCount;
if (Request.QueryString["Page"] != null)
CurPage=Convert.ToInt32(Request.QueryString["Page"]);
else
CurPage=1;
objPds.CurrentPageIndex = CurPage-1;
lblCurrentPage.Text = "óÔÒÁÎÉÃÁ ?: " + CurPage.ToString() + " ÏÔ ÏÂÝÏ " +
objPds.PageCount.ToString();
if(!objPds.IsFirstPage)
lnkFirst.NavigateUrl=Request.CurrentExecutionFilePath +"?Page=" +
Convert.ToString(FirstPage);
if(!objPds.IsFirstPage)
lnkPrev.NavigateUrl=Request.CurrentExecutionFilePath + "?Page=" +
Convert.ToString(CurPage-1);
if(!objPds.IsLastPage)
lnkNext.NavigateUrl=Request.CurrentExecutionFilePath + "?Page=" +
Convert.ToString(CurPage+1);
if(!objPds.IsLastPage)
lnkLast.NavigateUrl=Request.CurrentExecutionFilePath + "?Page=" +
Convert.ToString(LastPage);
MyRepeater.DataSource=objPds;
MyRepeater.DataBind();

On this page I have a DELETE_BUTTON. When I have more than 14 results(more
than 1 page) and when I push the Button it doesn't work. When I go to the
last page and push the button the code in ON_CLICK_METHOD works. I can't
understand why. Could you help me here?

Thanks a lot!

Viktor
 
V

Viktor Popov

Here it is the code for DELETE_BUTTON. I do loop through the RepeaterItems
and check if a CheckBox
control is checked:
private void Delete_Click(object sender, System.EventArgs e)
{
Session["queryStr"]=",";
int f=0;
foreach(RepeaterItem item in MyRepeater.Items)
{
CheckBox cb1 = item.FindControl("cb") as CheckBox;
CheckBox cb2 = item.FindControl("lbl") as CheckBox;
if(cb1.Checked==true)
{
Session["queryStr"]=Session["queryStr"].ToString()+cb2.Text+",";
f++;
}
}
if(f==0)
return;
Response.Redirect("dltad.aspx");
}
If a CheckBox from a row is Ckecked The Session["queryStr"]=the id of the
element which must be deleted and forwards to delete them in onether form.

Thank you!

Viktor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Repeater paging problem 13
Problem using custom paging 0
repeater 0
pagination in repeater issue. 0
Problem with codewars. 5
Repeater control 1
Paging Problem 1
Paging 0

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top