Repeater paging problem

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default Repeater paging 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?

    Thanks a lot!

    Viktor



    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
    Version: 6.0.767 / Virus Database: 514 - Release Date: 21.9.2004 a.


    Viktor Popov Guest

  2. Similar Questions and Discussions

    1. Paging an image repeater?
      Hello! I have this code which pumps some data into an array from a loop in the function. I cannot figure out what I need to do to hook this up to my...
    2. Problem with Repeater Control
      This might sound dum but i am having a problem with a Repeater Control in ASP.Net 2.0. My Website is consuming a webservice which returns an Array...
    3. Use Repeater to generate Formitem problem
      1. I have use a mxml program receive a xml to generate the Form . I need to use "repeat " function in <mx:Repeater> as i need to check what control...
    4. Paging problem
      Hi My form includes a dropdown list(DL) that represent types of customers and submit button(BTN). When I press the BTN it runs a query related to...
    5. another problem with paging
      I am having the same problem, How did you solve your problem? I can't open the first link in BalaKrishna's posting and i couldn't find the answer...
  3. #2

    Default Repeater paging 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 = "No?aieoa ?: " + CurPage.ToString() + " io iaui " +
    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?

    Thanks a lot!

    Viktor



    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
    Version: 6.0.767 / Virus Database: 514 - Release Date: 21.9.2004 a.


    Viktor Popov Guest

  4. #3

    Default Repeater paging 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 = "No?aieoa ?: " + CurPage.ToString() + " io iaui " +
    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?

    Thanks a lot!

    Viktor



    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
    Version: 6.0.767 / Virus Database: 514 - Release Date: 21.9.2004 a.


    Viktor Popov Guest

  5. #4

    Default Re: Repeater paging problem

    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



    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
    Version: 6.0.767 / Virus Database: 514 - Release Date: 21.9.2004 a.


    Viktor Popov Guest

  6. #5

    Default Re: Repeater paging problem

    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



    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
    Version: 6.0.767 / Virus Database: 514 - Release Date: 21.9.2004 a.


    Viktor Popov Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139