calender clientside DayRender Event not working

3 posts, 0 answers
  1. Ruchi
    Ruchi avatar
    54 posts
    Member since:
    Apr 2012

    Posted 09 Mar 2015 Link to this post

    Hello Team,

    I am using radCalender in my application. I want to highlight some special days with some counts inside it.

    ClientSide dayrender event is not firing. Can anyone help me out?

    Please find code below:
    <telerik:RadCalendar ID="RadCalendar2" runat="server" TitleFormat="MMMM yyyy" AutoPostBack="false">
                            <ClientEvents OnDayRender="OnDayRender"></ClientEvents>
                        </telerik:RadCalendar>
    function  OnDayRender(sender, args) {
                    alert('hi');                 
                    }

    I want to achive functionality provided here(Client-Side) : http://demos.telerik.com/aspnet-ajax/calendar/examples/programming/customdaycellrendering/defaultcs.aspx?show-source=true


    Thanks and Regards,
    Ruchi Patel


  2. Ruchi
    Ruchi avatar
    54 posts
    Member since:
    Apr 2012

    Posted 11 Mar 2015 Link to this post

    Hello Team,

    Solution : Day Render  will not fire client-side will the calendar is navigated to a view different that the current one.

    I need one more help for calender itself, Please find code below:

    <telerik:RadCalendar ID="Cal1" PresentationType="Preview" runat="server" DayNameFormat="Short" ShowRowHeaders="false" ShowOtherMonthsDays="false" Skin="Special" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false" EnableMonthYearFastNavigation="false">
        <CalendarDayTemplates>
            <telerik:DayTemplate ID="RedTemplate" runat="server">
                <Content>
                    <div class="rcTemplate rcRed" id="radTemplateDiv" runat="server" style="background-color: #ffffff; font-weight: normal;">
                        _date<br />
                        <p style="text-align: center; font-weight: bold; font-size: 16px;">_noCount</p>
                    </div>
                </Content>
            </telerik:DayTemplate>
        </CalendarDayTemplates>
        <ClientEvents OnInit="initializeCal" OnDayRender="RenderADay" OnLoad="moveToDecember" />
    </telerik:RadCalendar>

    <telerik:RadCodeBlock ID="rcCal" runat="server">
    <script type="text/javascript">
            var jsonResultData = "";
     var senderForOnLoad = '';
            function moveToDecember(sender) {
                var todaysDate = new Date();
                if (todaysDate.getMonth() != 11)
                    var triplet = [todaysDate.getFullYear() - 1, 12, 25];
                else
                    var triplet = [todaysDate.getFullYear(), 12, 25];
                sender.navigateToDate(triplet);           
                senderForOnLoad = sender;
                $.get('/api/CalenderWidget?WidMapID=' + 11, function (jsonResult) {
                    for (var i = 0; i < jsonResult.length; i++) {
                       // Here i need to redesign template by replacing "_date" , "_noCount" and "Color" with the result comes in jsonResult.
                    }
                });
     
            }
    </script>
    </telerik:RadCodeBlock>

    Please find comments, I need special days with colors and count comes from Database in jsonResult.

    Let me know if anyone can help.


    Thanks and Regards,
    Ruchi Patel
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 12 Mar 2015 Link to this post

    Hi,

    Initially RadCalendar is rendered on the server and that is why OnDayRender client-side event is not raised. Another possible solution is to register your script using server-side DayRender event. Here is an example:
    protected  void Cal1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
       {
           ScriptManager.RegisterStartupScript(Page, Page.GetType(), e.Day.Date.ToString(), "alert('RenderADay');", true);
       }

    Regards,
    Pavlina
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top