More in this section

Forums / Developing with Sitefinity / Having trouble binding News to a DataRepeater

Having trouble binding News to a DataRepeater

2 posts, 0 answered
  1. JGarland
    JGarland avatar
    30 posts
    Registered:
    11 Nov 2006
    07 May 2010
    Link to this post
    Having trouble binding News to a DataRepeater. It seems to work but there are no records in the datasource. Here is my code:

    <

     

    asp:Repeater ID="Repeater1" runat="server">

     

        <

     

    ItemTemplate>

     

     

            <p>

     

                <%

    #DataBinder.Eval(Container.DataItem, "Title")%>

     

     

                <hr>

     

                <%

    #DataBinder.Eval(Container.DataItem, "Title")%>

     

     

            </p>

     

     

        </ItemTemplate>

     

     

        <SeparatorTemplate></SeparatorTemplate>

     

    </

     

    asp:Repeater>

     

    Protected

     

    Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

     

     

        Dim newsManager = New Telerik.Cms.Engine.ContentManager("News")

     

        Repeater1.DataSource = newsManager.GetContent()

     

        Response.Write(Repeater1.Items.Count)

     

     

    End Sub

    The repeater item count is always zero even though I have two news items.

    Thanks

     

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    07 May 2010
    Link to this post
    Hi JGarland,

    Call Repeater1.DataBind() after setting the datasource.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
2 posts, 0 answered