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 bit of strange problem on this page: http://www.bluprintliving.com/locations it seems that
I'm having a strange problem. I have a HTML page with PHP code which
Today I faced a strange problem in C#. I have an ASP.NET page where
I'm writing a contact page, but I have a strange problem. Right from the
I have one of our projects very strange problem here on http://konyak.georates.net/page-2/ we have
I have a strange problem happening on one page I am making: myDiv.append(<img src='...'
I have a strange problem on a web page I'm working with. I have
I have a strange problem, Firefox 3.6.3 doesn't show the CSS of the page
I have a strange problem that I don't understand about DataPager. After changing the
I have a strange problem. I have configured our Websphere Application Server to run

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.