Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6068399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:42:39+00:00 2026-05-23T09:42:39+00:00

I’m trying to create a customer repeater with Paging and accompanying controls e.g. Next

  • 0

I’m trying to create a customer repeater with Paging and accompanying controls e.g. Next Prev buttons.

So far I have the custom repeater with Paged data working fine, and I can get it to render the navigation buttons aswell but I can’t assign events to the Navigation LinkButtons.

Here’s the Custom Repeater class:

using System.Web.UI.WebControls;
using System.Web.UI;
using System.Data;
using System.Collections;
using System;

namespace ASPresentation.Controls 
{
[ToolboxData("<cc:PagedRepeater runat=server></cc:PagedRepeater>")]
public class PagedRepeater : Repeater
{
    public int PageSize { get; set; }
    public int CurrentPageIndex { get; set; }
    public PagedDataSource pagedData = new PagedDataSource();
    LinkButton NextBtn = new LinkButton();
    LinkButton PrevBtn = new LinkButton();

    public bool IsLastPage
    {
        get
        {
            return pagedData.IsLastPage;
        }
    }
    public bool IsFirstPage
    {
        get
        {
            return pagedData.IsFirstPage;
        }
    }

    public override object DataSource
    {
        get
        {
            return base.DataSource;
        }
        set
        {
            pagedData.DataSource = (IEnumerable)value;
        }
    }

    protected void NextButtonClick(object sender, EventArgs e)
    {
        if (!IsLastPage)
        {
            CurrentPageIndex++;
        }
    }

    protected void PrevButtonClick(object sender, EventArgs e)
    {
        if (!IsFirstPage)
        {
            CurrentPageIndex--;
        }
    }

    protected override void OnInit(EventArgs e)
    {
        NextBtn.Text = "Next";
        PrevBtn.Text = "Prev";
        NextBtn.Click += new EventHandler(NextButtonClick);
        PrevBtn.Click += new EventHandler(PrevButtonClick);
        base.OnInit(e);
    }

    protected override void Render(HtmlTextWriter writer)
    {
        base.Controls.Add(PrevBtn);
        base.Controls.Add(NextBtn);
        base.Render(writer);
    }

    public override void DataBind()
    {
        pagedData.AllowPaging = true;
        pagedData.PageSize = PageSize;
        pagedData.CurrentPageIndex = CurrentPageIndex;
        base.DataSource = pagedData;
        base.DataBind();
    }
}
}

Anyone got any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:42:39+00:00Added an answer on May 23, 2026 at 9:42 am

    Try making this control a CompositeControl instead of inheriting from Repeater. Inside the composite, instantiate your Repeater, PagedDataSource, button controls, and any other controls necessary and add them to the control tree via overriding CreateChildControls. You can set up your event handlers at this point, too. Then, expose the repeater’s templates in the composite. I am offering this suggestion as a different approach as you are essentially writing a composite control. However, you’re not adding the buttons to one of the templates of the repeater at render time (say the footer), so you may be losing something.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.