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

Forums / Bugs & Issues / Error on edit news page on TUI

Error on edit news page on TUI

4 posts, 0 answered
  1. Vangelis
    Vangelis avatar
    153 posts
    Registered:
    07 Jan 2006
    06 Jun 2007
    Link to this post
    I add a news item to check dates of start and end (archiving) and when I tried to open for edit news page on TUI site I got the following error.

     

    Server Error in '/telerik/TIUSite' Application.

    Object reference not set to an instance of an object.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:

    Line 73: 
    Line 74: 		List<IMetaSearchInfo> filter = new List<IMetaSearchInfo>();
    Line 75: 		filter.Add(new MetaSearchInfo(MetaValueTypes.DateTime,
    Line 76: 						this.newsList.PublicationDateField, DateTime.Now, SearchCondition.LessOrEqual));
    Line 77: 		filter.Add(new MetaSearchInfo(MetaValueTypes.DateTime,

    Source File: c:\Program Files\telerik\Sitefinity3.0\TIUSite\UserControls\NewsEvents.ascx.cs    Line: 75

    Stack Trace:

    [NullReferenceException: Object reference not set to an instance of an object.]
       NewsEvents.CalculateDays() in c:\Program Files\telerik\Sitefinity3.0\TIUSite\UserControls\NewsEvents.ascx.cs:75
       NewsEvents.OnPreRender(EventArgs e) in c:\Program Files\telerik\Sitefinity3.0\TIUSite\UserControls\NewsEvents.ascx.cs:111
       System.Web.UI.Control.PreRenderRecursiveInternal() +77
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.312; ASP.NET Version:2.0.50727.312

    Best regards

    Vagelis
  2. Vangelis
    Vangelis avatar
    153 posts
    Registered:
    07 Jan 2006
    07 Jun 2007
    Link to this post
    Hi,

    What is really strange is that I did a rollback to a previous version of the page, delete the news content I create but the problem remains. I can view this page but I cannot edit it. Any idea how to repair this?

    Best regards

    Vagelis
  3. Vassil Daskalov
    Vassil Daskalov avatar
    261 posts
    Registered:
    18 May 2013
    07 Jun 2007
    Link to this post
    Hi Vagelis Kretsimos,

    It seems that there is a problem with the user control in design time as is the case with Edit Page. As you may already know, there you do not have a Page instance and this forces the exception. Fortunately, the problem is easy to maintain as the control has its codebehind. All you need to do is replace the CalculateDays() method code with this one in TIU\UserControls\NewsEvents.ascx.cs:

    protected void CalculateDays()  
        {  
            this.BindToNewsList();  
            if (this.newsList == null)  
                this.newsList = new NewsList();  
            NewsManager manager = new NewsManager(NewsManager.DefaultContentProvider);  
     
            List<IMetaSearchInfo> filter = new List<IMetaSearchInfo>();  
            filter.Add(new MetaSearchInfo(MetaValueTypes.DateTime,  
                            this.newsList.PublicationDateField, DateTime.Now, SearchCondition.LessOrEqual));  
            filter.Add(new MetaSearchInfo(MetaValueTypes.DateTime,  
                            this.newsList.ExpirationDateField, DateTime.Now, SearchCondition.GreaterThen));  
     
            IList source = manager.Content.GetContent(0, int.MaxValue, "", ContentStatus.Published, filter.ToArray());  
     
            int month = RadCalendar1.FocusedDate.Month;//DateTime.Now.Month;  
            int year = RadCalendar1.FocusedDate.Year;//DateTime.Now.Year;  
            foreach (IContent data in source)  
            {  
                DateTime date = (DateTime)data.GetMetaData("Publication_Date");  
                if (date.Month == month && date.Year == year)  
                    this.AddSpecialDay(date);  
            }  
        } 

    Hope this helps and sorry for the inconvenience caused.

    All the best,
    Vassil Daskalov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  4. Vangelis
    Vangelis avatar
    153 posts
    Registered:
    07 Jan 2006
    07 Jun 2007
    Link to this post
    Hi Vlad,

    Thanks for your reply. It corrected the error and now edit open as before.

    Best regards

    Vagelis
Register for webinar
4 posts, 0 answered