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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:09:50+00:00 2026-05-16T20:09:50+00:00

I have a repeater on which I bind a list with 3 items. The

  • 0

I have a repeater on which I bind a list with 3 items. The databind() is called once, I have checked this using the debugger. I have some strange behavior here because the Repeater seems to walk through this list of items twice. Instead of the 3 items, I see the repeater bind everything twice.

    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        Sitecore.Data.Items.Item contextItem = Sitecore.Context.Item;
        Sitecore.Data.Fields.MultilistField thisSnippets = contextItem.Fields["snippets"];
        List<Item>thisSnippetItems = thisSnippets.GetItems().ToList<Item>();

        if (thisSnippetItems.Count > 0)
        {
            rptListRenderer.DataSource = thisSnippetItems;
            rptListRenderer.DataBind();
        }
    }


    /// <summary>
    /// Handles the ItemDataBound event of the rptListRenderer control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.Web.UI.WebControls.RepeaterItemEventArgs"/> instance containing the event data.</param>
    private void rptListRenderer_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
        {
            Item dataItem = (Item)e.Item.DataItem;

            System.Web.UI.WebControls.PlaceHolder phLiContent = (System.Web.UI.WebControls.PlaceHolder)e.Item.FindControl("phLiContent");

            if (phLiContent != null)
            {
                Sitecore.Data.Items.DeviceItem listItemDevice = Sitecore.Context.Database.Resources.Devices["List item"];
                RenderingReference[] renderings = dataItem.Visualization.GetRenderings(listItemDevice, false);

                foreach (RenderingReference rendering in renderings)
                {
                    string strDataSource = dataItem.ID.ToString();
                    rendering.Settings.DataSource = strDataSource;

                    Sublayout thisControl = (Sublayout)rendering.RenderingItem.GetControl(rendering.Settings);           

                    if (blockCounter == 0)
                    {
                        thisControl.Parameters = "class=snippetColHomeFirst";
                    }
                    else
                    {
                        thisControl.Parameters = "class=";
                    }

                    phLiContent.Controls.Add(thisControl);

                    blockCounter++;
                }
            }
        }

repeater html:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="hpSnippetList.ascx.cs" Inherits="Snippets.Sublayouts.hpSnippetList" %>
<%@ Register TagPrefix="sc" Namespace="Sitecore.Web.UI.WebControls" Assembly="Sitecore.Kernel" %>
<asp:repeater id="rptListRenderer" runat="server" EnableTheming="false" EnableViewState="false">
 <itemtemplate>
   <asp:placeholder id="phLiContent" runat="server" />
 </itemtemplate>
</asp:repeater>

Any suggestions on how this can be solved?
Page load is called only once, databind() is only called once.

  • 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-16T20:09:51+00:00Added an answer on May 16, 2026 at 8:09 pm

    Perhaps you called DataBind method in one of the control’s parents. According to http://msdn.microsoft.com/en-us/library/w5e5992d.aspx (DataBind docs):

    When called on a server control, this
    method resolves all data-binding
    expressions in the server control and
    in any of its child controls.

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

Sidebar

Related Questions

I have a repeater control outputting some HTML. I want a table which outputs
I have an Asp.Net repeater, which contains a textbox and a checkbox. I need
i have a repeater that will output a series of items: <asp:repeater ... runat=Server>
Which method is better (performance-wise) if I have DataBoundControl such as GridView, Repeater, and/or
I have a repeater that outputs divs like the following for every item returned
I have a repeater control where in the footer I have a DropDownList. In
I have a repeater control on an ASP.NET 2.0 web form. As I understanding
I have a Repeater with a Button inside the ItemTemplate . I added the
I have a Repeater contol bound to a custom object (an EntitySpaces query) and
i have a repeater than creates a table: <itemtemplate> <tr id=theTableRow runat=server> <td> <asp:LinkButton

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.