This is a migrated thread and some comments may be shown as answers.

[Solved] Possible bug when loading Calendar using AjaxRequest

1 Answer 16 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
David Driscoll
Top achievements
Rank 1
David Driscoll asked on 04 Mar 2011, 08:25 PM
One of my coworkers recently found an issue that the MVC Calendar wasn't writing out and executing the related javascript to power the Calendar.  I did an investigation and it I located the issue.

The write HTML method in Telerik.Web.Mvc/UI/Calendar/Calendar.cs is not calling base.WriteHtml(writer) as per below:
protected override void WriteHtml(System.Web.UI.HtmlTextWriter writer)
{
    ICalendarHtmlBuilder renderer = rendererFactory.Create(this);
 
    DefineUrlFormat();
 
    IHtmlNode rootTag = renderer.Build();
 
    IHtmlNode contentTag = renderer.ContentTag();
    contentTag.Children.Add(BuildWeekHeader(renderer));
    contentTag.Children.Add(BuildMonthView(renderer));
 
    rootTag.Children.Add(contentTag);
 
    rootTag.WriteTo(writer);
}

When I looked all the other related controls ComboBox, DatePicker, Editor, Grid, etc, they all call base.WriteHtml(writer) in their WriteHtml methods.  I've fixed the Calendar.cs for our code base to also call base.WriteHtml(writer) as per below:
protected override void WriteHtml(System.Web.UI.HtmlTextWriter writer)
{
    ICalendarHtmlBuilder renderer = rendererFactory.Create(this);
 
    DefineUrlFormat();
 
    IHtmlNode rootTag = renderer.Build();
 
    IHtmlNode contentTag = renderer.ContentTag();
    contentTag.Children.Add(BuildWeekHeader(renderer));
    contentTag.Children.Add(BuildMonthView(renderer));
 
    rootTag.Children.Add(contentTag);
 
    rootTag.WriteTo(writer);
 
    base.WriteHtml(writer);
}

I assume the calendar should also call the base.WriteHtml(writer) but it may be possible that it doesn't for a specific reason that I'm unaware of.  If it was left our with a specific reason any clarification would be helpful.

Thanks,
David Driscoll

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 07 Mar 2011, 09:57 AM
Hello David,

 
You are absolutely correct. Override of the WriteHtml method should call base.WriteHtml(writer). I have fixed this issue in our code and it will be included in the next official release of Telerik components for ASP.NET MVC.

I have updated your Telerik points for the bug report.

Regards,
Georgi Krustev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Calendar
Asked by
David Driscoll
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or