473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

repeater problem

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.CurrentExecutionFileP ath +"?Page=" +
Convert.ToString(FirstPage);
if(!objPds.IsFirstPage)
lnkPrev.NavigateUrl=Request.CurrentExecutionFilePa th + "?Page=" +
Convert.ToString(CurPage-1);
if(!objPds.IsLastPage)
lnkNext.NavigateUrl=Request.CurrentExecutionFilePa th + "?Page=" +
Convert.ToString(CurPage+1);
if(!objPds.IsLastPage)
lnkLast.NavigateUrl=Request.CurrentExecutionFilePa th + "?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?
Here it is the code for the DELETE_BUTTON. I 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 another form.

Thanks a lot!

Viktor

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.767 / Virus Database: 514 - Release Date: 21.9.2004 a.
Nov 16 '05 #1
0 915

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: mark | last post by:
My problem is I need to have a "nested" repeater. I have an array which I load into a hashtable - that part works great. I can setup the second repeater to work just fine, as long as it's not...
2
by: Stephen Miller | last post by:
I am using the OnItemDataBound event of Repeater control to nest a DataGrid within the Repeater. When I attempt to bind to the DataGrid using the DataSource method I get the error message "Object...
2
by: Colin Nicholls | last post by:
Platform: ASP.NET 1.1 I have a repeater nested inside another repeater. My outer repeater is looping fine. I am manually binding the inner repeater to a DataReader obtained from another...
8
by: I am Sam | last post by:
Hi everyone, This problem is making me old. I don't want to get any older. I have a multi-nested repeater control as follows: <asp:Repeater ID="clubRep1" Runat="server">...
3
by: Shimon Sim | last post by:
I put linkbutton in a repeater header. I attached event handler in makeup as onclick="btnSort_Click". Made btnSort_Click method public. It doesn't fire if I click on it. I tried to attach it in...
2
by: mark | last post by:
(not sure if this is the correct group) My problem is I need to have a "nested" repeater. I have an array which I load into a hashtable - that part works great. I can setup the second repeater...
0
by: uncensored | last post by:
Hello everyone, I'm fairly new at .Net and I have a repeater inside a repeater problem. I will attach my code to this message but basically what I am able to tell when I run my page it tells me...
7
by: | last post by:
I have what's probably a simple page lifecycle question related to dynamically evaluating values that are placed by a repeater and dynmically placing user controls that use those values. I'm...
1
by: jazzart | last post by:
Hi there, I'm fairly new to programming with Asp.Net 2.0 so I'm finding myself regularly fumbling around in the dark a bit, so to speak. I'm currently using Visual Web Developer and have been...
2
by: Hong | last post by:
Hi, I have been scratching my head over this problem for hours, the repeater control I am using would only render the controls specified in HeaderTemplate and FooterTemplate, but the repeater...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.