1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Error on Control

Error on Control

3 posts, 0 answered
  1. Steven Lancaster
    Steven Lancaster avatar
    82 posts
    Registered:
    06 Nov 2009
    22 Jan 2010
    Link to this post
    Here is file PostByReporter.ascx

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="PostByReporter.ascx.cs" Inherits="Sitefinity_ControlTemplates_Blogs_PostByReporter" %> 
    <%@ Register Assembly="Telerik.Blogs" Namespace="Telerik.Blogs.WebControls" TagPrefix="sfWeb" %> 
    <%@ Register Assembly="Telerik.Cms.Engine" Namespace="Telerik.Cms.Engine.WebControls" TagPrefix="sfWeb" %> 
    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Cms.Web.UI" TagPrefix="sfCtrl" %> 
    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Cms.Web.UI" TagPrefix="sfWeb" %> 
    <sfWeb:CssFileLink ID="CssFileLink1" FileName="~/Sitefinity/ControlTemplates/Blogs/blogsLayout.css" Media="screen" runat="server" /> 
     
    <%@ Register TagPrefix="TN" TagName="ucPostAnonomously" Src="~/Sitefinity/ControlTemplates/Blogs/ucPostAnonomously.ascx" %> 
    <%@ Register TagPrefix="TN" TagName="ucSendFriend" Src="~/Sitefinity/ControlTemplates/Blogs/ucSendFriend.ascx" %> 
     
    <div style="clear:both;"></div> 
    <asp:Repeater ID="repeater" runat="server" OnItemDataBound="repeater_ItemDataBound">  
     <HeaderTemplate> 
            <ul class="sf_postListing">  
        </HeaderTemplate> 
        <ItemTemplate> 
            <li id="liPost" runat="server">  
                <h2 class="sf_postTitle">  
                    <asp:HyperLink ID="fullContent1" runat="server">  
                        <asp:Literal ID="Title" runat="server"></asp:Literal> 
                    </asp:HyperLink> 
                </h2>              
     
                <class="sf_postDate">  
                    <sfCtrl:DateTimeLiteral runat="server" ID="Publication_Date" DateFormatString="D"></sfCtrl:DateTimeLiteral> 
                </p> 
                <asp:Panel id="pnlPostContent" runat="server" CssClass="sf_postContent">  
                    <asp:Literal ID="content" runat="server"></asp:Literal> 
                </asp:Panel> 
                  
                <class="sf_postComments">  
     
                <%--<div class="bTags"><span>Tags:</span>   
                    <asp:Repeater ID="Repeater1" runat="server">   
                          <ItemTemplate>   
                                <asp:HyperLink ID="tagLink" runat="server" />   
                          </ItemTemplate>     
                      </asp:Repeater>     
                </div>--%> 
                <div class="allReports"></div> 
                 <div class="clearing"></div> 
                   
                    <div class="grid-btBlock">  
                    <div class="cPosts">  
                        
                    <%--<asp:HyperLink cssclass="post-a-comment" ID="CommentsLink" runat="server" NavigateUrl="{0}#comments">--%> 
                    <asp:HyperLink cssclass="post-a-comment" ID="CommentsLink" NavigateUrl='<%#string.Format("~/BlogComment/{0}.aspx#comments",DataBinder.Eval(Container.DataItem, "URL"))%>' runat="server">  
                    &nbsp;  
                    </asp:HyperLink> 
                    <%--<asp:HyperLink ID="fullContent3" runat="server" NavigateUrl="{0}#comments">--%> 
                    <asp:HyperLink cssclass="" ID="HyperLink1" NavigateUrl='<%#string.Format("~/BlogComment/{0}.aspx#comments",DataBinder.Eval(Container.DataItem, "URL"))%>' runat="server">  
                      <span class="count"><asp:Label ID="CommentsCount" runat="server"></asp:Label> Posts</span></asp:HyperLink> 
                          
                    </div> 
                  </div> 
                </p> 
                  
                <p></p>  
                  
            </li> 
              
        </ItemTemplate> 
        <FooterTemplate> 
            </ul> 
        </FooterTemplate> 
    </asp:Repeater> 
     


    Here is file PostByReporter.ascx.cs

    using System;  
    using System.Data;  
    using System.Configuration;  
    using System.Web;  
    using System.Web.Security;  
    using System.Web.UI;  
    using System.Web.UI.HtmlControls;  
    using System.Web.UI.WebControls;  
    using System.Web.UI.WebControls.WebParts;  
    using Telerik.News.WebControls;  
    using Telerik.Cms.Web;  
    using Telerik.Cms.Engine;  
    using Telerik.Cms.Engine.ContentViewFiltering;  
    using System.Collections;  
    using Telerik.Blogs;  
    using DeepBlueCore;  
     
    public partial class Sitefinity_ControlTemplates_Blogs_PostByReporter : System.Web.UI.UserControl  
    {  
        protected void Page_Load(object sender, EventArgs e)  
        {  
     
        }  
     
        #region Events  
        protected void repeater_ItemDataBound(object sender,  RepeaterItemEventArgs e)  
        {  
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))  
            {  
                HtmlControl liPost = (HtmlControl)e.Item.FindControl("liPost");  
     
                IContent dataItem = (IContent)e.Item.DataItem;  
     
                if (Common.QueryString("rpt") == (string)dataItem.GetMetaData("Reporter"))  
                {  
                    liPost.Visible = true;  
                }  
                else  
                {  
                    liPost.Visible = false;  
                }              
            }  
        }  
     
        #endregion     

    I am gettin an error that is attached everytime I try to use this control. Can you see anything obvious?

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    22 Jan 2010
    Link to this post
    Hi Steven Lancaster,

    The control you have pasted here  is located in Sitefinity/ControlTemplates/Blogs/ folder. Since the error is thrown from a control located in TheNerve/UserControls/PostByReporter.ascx.cx. These seems to be two different controls. Also you are getting the error, because the manager you call is null or the object does not exsist.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Steven Lancaster
    Steven Lancaster avatar
    82 posts
    Registered:
    06 Nov 2009
    22 Jan 2010
    Link to this post
    How do I delete the control out and recreate pointing to these pages?
Register for webinar
3 posts, 0 answered