RadListView and News - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

RadListView and News

  • RadListView and News
  • Hi I'm styling the widget template for News and the OnItemDataBound event does not seem to be firing.  Can someone please help?  This is my code:

    <%@ Control Language="C#" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.ContentUI" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
     
    <script type="text/C#" runat="server">
        protected void DetailsView_ItemDataBound(object sender, RadListViewItemEventArgs e)
            if (e.Item is RadListViewDataItem)
                PlaceHolder ImagePlaceholder = (PlaceHolder)e.Item.FindControl("ImagePlaceholder");
                RadListViewDataItem lvItem = (RadListViewDataItem)e.Item;
                ImagePlaceholder.Visible = (bool)(lvItem.GetDataKeyValue("Picture").ToString().Trim().Length > 0);
            
        
    </script>
     
    <telerik:RadListView ID="DetailsView" ItemPlaceholderID="ItemContainer" AllowPaging="False" runat="server" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false"
                        OnItemDataBound="DetailsView_ItemDataBound">
        <LayoutTemplate>
            <div class="news-desc">
                <asp:PlaceHolder ID="ItemContainer" runat="server" />
                <sf:MasterViewHyperLink ID="MasterViewHyperLink1" Text="« Back" runat="server" />
            </div>
        </LayoutTemplate>
        <ItemTemplate>
            <h1>
                <asp:Literal ID="Literal1" Text='<%# Eval("Title") %>' runat="server" />
            </h1>
            <h2>
                <sf:FieldListView ID="PublicationDate" runat="server" Format="PublicationDate.ToLocal():MMM dd, yyyy" /> - Latest Market Trends
            </h2>
            <p>By: <%# Eval("Author")%></p>
            <ul class="news-desc1">
                <asp:PlaceHolder ID="ImagePlaceholder" runat="server">
                <li class="news-desc1-li"><img src='<%# ResolveUrl(Eval("Picture")) %>' alt="Client Research Picture" /></li>
                </asp:PlaceHolder>
                <li class="sec-section news-desc1-li"><asp:Literal ID="Literal2" Text='<%# Eval("Content") %>' runat="server" /></li>
            </ul>
            <sf:ContentBrowseAndEditToolbar ID="BrowseAndEditToolbar" runat="server" Mode="Edit,Delete,Unpublish"></sf:ContentBrowseAndEditToolbar>
        </ItemTemplate>
    </telerik:RadListView>
  • Hello Devin,

    I checked a simple case (change a title text of an literal ) and the event is fired in the scenario you are describing and everything works fine.  I tested with version Sitefintiy 4.1, so you need to upgrade to latest version released.

    <%@ Control Language="C#" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.ContentUI" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
     
    <script type="text/C#" runat="server">
        protected void DetailsView_ItemDataBound(object sender, RadListViewItemEventArgs e)
         if (e.Item is RadListViewDataItem)
              Literal lit = (Literal)e.Item.FindControl("Literal2");
                
              if(lit!=null)
              
                  lit.Text="myText";
              
           
        
    </script>
     
    <telerik:RadListView ID="DetailsView" ItemPlaceholderID="ItemContainer" AllowPaging="False" runat="server" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false" OnItemDataBound="DetailsView_ItemDataBound">
        <LayoutTemplate>
            <div class="sfnewsDetails">
                <div class="sfnewsLinksWrp">
                    <sf:MasterViewHyperLink class="sfnewsBack" Text="<%$ Resources:NewsResources, AllNews %>" runat="server" />
     
                <asp:PlaceHolder ID="ItemContainer" runat="server" />
            </div>
        </LayoutTemplate>
        <ItemTemplate>
            <h1 class="sfnewsTitle">
               <asp:Literal Text='<%# Eval("Title") %>' runat="server" />
               <asp:Literal Id ="Literal2" Text='<%# Eval("Title") %>' runat="server" />
            </h1>
            <div class="sfnewsAuthorAndDate">
                <asp:Literal Text="<%$ Resources:Labels, By %>" runat="server" />
                <sf:PersonProfileView runat="server" /> | <sf:FieldListView ID="PublicationDate" runat="server"
                    Format="PublicationDate.ToLocal():MMM dd, yyyy" />
            </div>
            <sf:ContentBrowseAndEditToolbar ID="BrowseAndEditToolbar" runat="server" Mode="Edit,Delete,Unpublish"></sf:ContentBrowseAndEditToolbar>
            <sf:FieldListView ID="summary" runat="server" Text="0" Properties="Summary" WrapperTagName="div" WrapperTagCssClass="sfnewsSummary"  />
            <div class="sfnewsContent">
                <asp:Literal ID="Literal1" Text='<%# Eval("Content") %>' runat="server" />
            </div>
            <sf:ContentView
                 id="commentsListView"
                 ControlDefinitionName="NewsCommentsFrontend"
                 MasterViewName="CommentsMasterView"
                 ContentViewDisplayMode="Master"
                 runat="server" />
             <sf:ContentView
                 id="commentsDetailsView"
                 ControlDefinitionName="NewsCommentsFrontend"
                 DetailViewName="CommentsDetailsView"
                 ContentViewDisplayMode="Detail"
                 runat="server" />
        </ItemTemplate>
    </telerik:RadListView>
    Kind regards,
    Milena
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>