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 4345490
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:02:35+00:00 2026-05-21T12:02:35+00:00

I have a Page with 2 repeaters on it and each repeater contains a

  • 0

I have a Page with 2 repeaters on it and each repeater contains a user control.

The idea is that when you click a button on the usercontrol in the repeater on the left, data is retrieved from the database and set as the datasource for the repeater on the right.
I use event bubbling to pass the event from the user control to the page so I can get the data and set it for the other repeater.

My problem is that the ItemDataBound event handler doesn’t get called again after setting the repeater source in the event handler of the page for the user control button event.

Here’s the layout of the page

<div id="leftDiv">
    <asp:Repeater ID="rptUser" runat="server">
        <ItemTemplate>
            <custom:UserInfo ID="cstUserInfo" runat="server" />
            <br />
        </ItemTemplate>
    </asp:Repeater>
</div>
<div id="rightDiv">
    <asp:Repeater ID="rptMessages" runat="server">
        <ItemTemplate>
            <custom:MessageDetails ID="cstMessageDetails" runat="server" />
        </ItemTemplate>
    </asp:Repeater>
</div>

And here’s the event handler for the user control button click event.

private void cstUserInfo_ShowMessagesClicked(object sender, EventArgs e)
{
    UserInfoControl userInfoControl = sender as UserInfoControl;
    //Get the messages
    messageManager = new MessageManager();
    List<Messages> messages = messageManager.GetMessageDetailsByUserId(userInfoControl.CurrentUser.Id).ToList();

    rptTimeline.DataSource = messages;
    rptTimeline.ItemDataBound += new RepeaterItemEventHandler(rptMessages_ItemDataBound);
    rptTimeline.DataBind();
}

When I click the button on the user control the following happens:

  1. Page_Load of the page executes, which sets the default source for the second repeater
  2. The ItemDataBound handler for the repeater executes which sets the properties of the user control with the data
  3. Page_Load of the user controls executes which sets labels on the user control with its property values.
  4. The event handler cstUserInfo_ShowMessagesClicked executes that sets a new datasource for the repeater
  5. The Page_load of the user control executes again and throws an exception because the properties are not set yet

Is there any way to bind the new data to the second repeater when a button on the user control in the first repeater is pressed?

  • 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-21T12:02:36+00:00Added an answer on May 21, 2026 at 12:02 pm

    You’ll want to use ItemCreated.

    repeater.ItemCreated += new ItemCreatedEventHandler()
    

    It’s called each time an item is created to be bound to the repeater.

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

Sidebar

Related Questions

I have a master page called SampleMaster.master and this page contains a Repeater control
I have a repeater and each item contains a button which should redirect to
I have a repeater control that houses several RadioButtonLists with various RadioButtons in each
Inside my Content page I have a repeater control, which contains multiple controls along
I have a repeater that places 600+ textboxes filled with data on my page.
I have a Repeater control in my aspx page: <asp:Repeater ID=repeater runat=server EnableViewState=false> <ItemTemplate>
I have a asp.net repeater control in a aspx page, with runat=server and an
I have a Repeater in my page and after databinding, I have to click
I have written a user control that captures some user input and has a
I have a jquery tab on my page, where each list item contains a

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.