datepicker:can i call dayrender event on onpopup

5 posts, 0 answers
  1. Krishna
    Krishna avatar
    89 posts
    Member since:
    Jul 2008

    Posted 29 Sep 2009 Link to this post

    Hi,
    I want to call dayrender event when the user click on caledar icon (when it popsup)

    so that i can do some changes to dates of that current month styles.

    or is there anyway i can call/fire the dayrender event though any javascript function..
    Thanks
    -Krishna
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 30 Sep 2009 Link to this post

    Hello Krishna,

    Try the following approach in order to fire the OnDayRender event on opening the popup.

    ASPX:
     
    <telerik:RadDatePicker ID="RadDatePicker1" runat="server" AutoPostBack="True"
        <ClientEvents OnPopupOpening="OnPopupOpening" /> 
        <Calendar AutoPostBack="true" OnDayRender="RadCalendar1_DayRender"
        </Calendar> 
    </telerik:RadDatePicker> 

    JavaScript:
     
    <script type="text/javascript"
        function OnPopupOpening(sender, args) { 
            sender.get_calendar().raise_dayRender()
        } 
    </script> 

    C#:
     
    protected void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e) 
     

    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Krishna
    Krishna avatar
    89 posts
    Member since:
    Jul 2008

    Posted 30 Sep 2009 Link to this post

    Hi Shinu,
    thank you .. but I want to call the

    function

     

    OnDayRender(calendarInstance, args) {

     

    }

    of javascript and not the server one..
    can you please give any sample of calling the OnDayRender of client side from OnPopupOpening.
    I tried but i am unable to get the "args" with that call..

    Please help
    below is the code

    <

     

    telerik:RadDatePicker ID="RadDatePicker1" runat="server" AutoPostBack="True">

     

     

    <ClientEvents OnPopupOpening="OnPopupOpening" />

     

     

    <Calendar runat="server">

     

     

    <ClientEvents OnDayRender="OnDayRender"/>

     

     

    </Calendar>

     

    </

     

    telerik:RadDatePicker>

     



    function

     

    OnPopupOpening(sender, args) {

     

    sender.get_calendar().raise_dayRender();

    }



     

    function OnDayRender(calendarInstance, args) {

     

     

    if (args.Date[2] == 1 || args.Date[2] == 2 || args.Date[2] == 3) {

     

    args.Cell.innerHTML =

    "<span>" + args.Date[2] + "</span>";

     

    args.Cell.className =

    "otherMonth";

     

    args.Cell.DayId =

    "";

     

    }

    }

  5. Krishna
    Krishna avatar
    89 posts
    Member since:
    Jul 2008

    Posted 02 Oct 2009 Link to this post

    i could solve as below 

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="disable.aspx.cs" Inherits="disable" %> 
    <%@ Register Assembly="RadCalendar.Net2" Namespace="Telerik.WebControls" TagPrefix="radCln" %> 
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    <html xmlns="http://www.w3.org/1999/xhtml">  
    <head runat="server">  
        <title></title>  
          
    </head> 
    <body> 
        <form id="form1" runat="server">  
        <div> 
           <script type="text/javascript">  
            function OnDayRender(calendarInstance, args) {  
                var d = args.Date[0] + ',' + args.Date[1] + ',' + args.Date[2];  
                   if(document.getElementById('dates').value.indexOf(d)>-1)  
                    {  
                        args.Cell.style.backgroundColor ="gray" 
                    }  
                }  
                function OnDateClick(calendarInstance, args) {  
                    var d = args.RenderDay.Date[0] + ',' + args.RenderDay.Date[1] + ',' + args.RenderDay.Date[2];  
                    if (document.getElementById('dates').value.indexOf(d) > -1) {  
                        return false;  
                    }  
                }  
                  
                 function navigateCalendar() {  
                  var ss = <%= rdpMulTrendFromDate.ClientID %>;  
                  var calendar = ss.GetCalendar();  
                 var seldate = [2009, 9, 2];  
                  calendar.NavigateToDate(seldate);  
              }  
        </script> 
       
            <radCln:RadDatePicker  Width=100px ID="rdpMulTrendFromDate" DateInput-Height=15px  runat="server"  DateInput-Enabled="false"   
                            EnableViewState="true" > 
                            <Calendar > 
                            <ClientEvents OnDayRender ="OnDayRender" OnDateClick="OnDateClick"/>  
                            </Calendar> 
                            </radCln:RadDatePicker> 
                  
         <button id="button2" onclick="navigateCalendar(); return false;" style="width:105px;height:30px;">Apply on client</button> 
    <asp:HiddenField runat="server" ID="dates" Value="2009,5,22009,7,72009,7,82009,7,92009,7,102009,7,112009,7,122009,7,132009,7,142009,7,152009,7,162009,7,172009,7,182009,7,192009,7,202009,7,212009,7,222009,7,232009,7,242009,7,252009,7,262009,7,272009,7,282009,7,292009,7,302009,7,312009,8,12009,8,22009,8,32009,8,42009,8,52009,8,62009,8,72009,8,82009,8,92009,8,102009,8,122009,8,132009,8,142009,8,152009,8,162009,8,172009,8,182009,8,202009,8,222009,8,232009,8,242009,8,252009,8,262009,8,27" /> 
        </div> 
        </form> 
    </body> 
    </html> 
     

     

  6. John
    John avatar
    10 posts
    Member since:
    Jun 2010

    Posted 30 Jan 2012 Link to this post

    I don't know if this helps but i did the below to get the calendar to render properly on the first opening as during ajax it doesn't seem to work properly

        function OnPopupOpening(sender, args) { 
            sender.get_calendar()._navigateNext(); 
            sender.get_calendar()._navigatePrev();
        } 
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017