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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:11:47+00:00 2026-05-12T16:11:47+00:00

A strange problem. On my page i have a placeholder where I create a

  • 0

A strange problem.
On my page i have a placeholder where I create a repeater on run time.
In ItemTemplate i have a button that invokes repeater_ItemCommand event.

I put a breakpoint on first line of repeater_ItemCommand event, when the button is triggered the event is invoked as planned, but after RebindRepeaters() is finished, when i click on the button again repeater_ItemCommand event is not invoked!
Only if i click on the button one again it invokes, in other scenarios(this is simple version of my page, in original page i have updatepanel that complex everything) it never invokes!

My aspx code:

<form id="form1" runat="server">
    <div id="talk">          
          <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
    </div>                                                 

My Code-behind:

protected void Page_Init(object sender, EventArgs e)
{
    RebindRepeaters();
}

void RebindRepeaters()
{
    PlaceHolder1.Controls.Clear();     
    CreateRepeater(PlaceHolder1);
} 

void CreateRepeater(Control container)
{
    Repeater repeater1 = new Repeater();       

    repeater1.ItemCommand += new RepeaterCommandEventHandler(repeater_ItemCommand);
    repeater1.ItemTemplate = Page.LoadTemplate("CommentsTemplate.ascx");
    container.Controls.Add(repeater1);

    repeater1.DataSource = Comment.GetCommentsP(8, 0);
    repeater1.DataBind();
}

void repeater_ItemCommand(object sender, RepeaterCommandEventArgs e)
{
    switch (e.CommandName)
    {                          
        case "Edit":               
            RebindRepeaters();
            break;
    }
}

The CommentsTemplate.ascx:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CommentsTemplate.ascx.cs" Inherits="CommentsTemplate" %>

 <ul>
    <li>
      <div class="show">

         <div class="c">                  
             <asp:LinkButton ID="lbtnTitle" runat="server"  Text='<%#Eval("EncodedTitle")%>' 
                 CausesValidation="false"  CommandName="VoteUp" OnClientClick="viewHide(this);return false;"   CommandArgument='<%#Eval("ID")%>'></asp:LinkButton>                              
             <p class="d"><%#Eval("AddedBy")%>,<%#Eval("AddedDate")%></p>
             <div class="CommentBody"><%# Eval("EncodedBody") %>
             </div>
         </div>
             <div class="userpanel">


               <asp:Panel runat="server" ID="panAdmin" Visible='<%# UserCanEdit %>' style="float:left;">
                 <asp:ImageButton runat="server" ID="btnSelect" CommandName="Edit" CommandArgument='<%# Eval("ID") %>'
                     CausesValidation="false" AlternateText="Edit comment" ImageUrl="~/Images/Edit.gif"  />                
                 <asp:ImageButton runat="server" ID="btnDelete" CommandName="Delete" CommandArgument='<%# Eval("ID") %>'
                   CausesValidation="false" AlternateText="Delete comment" ImageUrl="~/Images/Delete.gif"
                   OnClientClick="if (confirm('Are you sure you want to delete this comment?') == false) return false;" />
               </asp:Panel>  

             </div>                                                        
      </div>                
            </li>
 </ul>  

If you need more info just ask.

  • 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-12T16:11:47+00:00Added an answer on May 12, 2026 at 4:11 pm

    Could you try overidding createChildcontrols and add the RebindRepeaters call there instead of in Page_Init? And make sure to give your repeater an explicit ID:

    Repeater repeater1 = new Repeater(); 
    repeater1.ID = "repeater1";
    

    Without an id the asp.net event handling won’t know where the event was called from.

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

Sidebar

Related Questions

I have a very strange problem. Under some elusive circumstances I fail to apply
I'm having a strange problem. I have to use GetPostBackEventRefence to force a Postback,
I have a very strange problem, when I try to var_dump (or print_r )
I have a very strange problem with the Delphi 2006 IDE. If the IDE
We have very strange problem, one of our applications is continually querying server by
I am seeing a strange problem: I have a linux machine, installed JDK1.6 on
I have strange problem with sharepoint and ajax functionality. We have an UpdatePanel placed
I'm having a strange problem in Visual Studio 2008 where my Pending Checkins window
I've got a strange problem with SQL Server 2000, and I just can't think
I've got a strange problem with indexing PDF files in SQL Server 2005, and

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.