Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2235
webMonthCalendar Initialize events..
posted

I am trying to run a client side script on the initialize event of the control.

I am converting from the old webcalendar to the new one.

I have some code on the server side like below..

wbcCal1.ClientEvents.Initialize = "initCalendars"
wbcCal2.ClientEvents.Initialize = "initCalendars"
wbcCal3.ClientEvents.Initialize = "initCalendars"

etc..

The javascript is:

function initCalendars(sender,e) {
            var cal0 = $find("wbcCal1");
            if (owner == cal0)
                sixCalendars[0] = cal0;
            var cal1 = $find("wbcCal2"); // document.getElementById("wbcCal2");
            if (owner == cal1)
                sixCalendars[1] = cal1;
            var cal2 = document.getElementById("wbcCal3");
            if (owner == cal2)
                sixCalendars[2] = cal2;
            var cal3 = document.getElementById("wbcCal4");
            if (owner == cal3)
                sixCalendars[3] = cal3;
          
            if (cal0 != null && cal1 != null && cal2 != null ) {
 
                var year = cal0._days[15].year;
                var month = cal0._days[15].month + 1;
                if (month > 12) {
                    year++;
                    month = 1;
                }
 
                if (cal1._days[15].year != year || cal1._days[15].month != month)
                    cal1.setVisibleMonth(new Date(year, month - 1, 1));
 
                if (++month > 12) {
                    year++;
                    month = 1;
                }
 
                if (cal2.control._days[15].year != year || cal2.control._days[15].month != month)
                    cal2.setVisibleMonth(new Date(year, month - 1, 1));
 
                if (++month > 12) {
                    year++;
                    month = 1;
                }
 
                if (cal3.control._days[15].year != year || cal3.control._days[15].month != month)
                    cal3.setVisibleMonth(new Date(year, month - 1, 1));
 
                if (++month > 12) {
                    year++;
                    month = 1;
                }
 
              
 
      
            }
        }

The js above has been trimmed, but you can get the idea.
On the page load, the initialize event fires and I can get the control for the first calendar "wbcCal1"
however, parsing through the list I can't get the second or third controls.

So I am not even sure I am getting/using the correct terminology to get the controls correctly.
and second, will this even work? I tried putting this code in the page_initComplete to make sure the controls were rendered but still no joy.

Some guidance on which is the proper event to call to get the objects would be helpful.


Parents
  • 2235
    posted

    Let me add, that what I am trying to do is...

    On the initialize event of the calendarmonthview..

    Loop through them all and set initial dates for each one.

    the initCalendars clientside js function is only returning the first cal1 object.

    I need to find a method of getting the other calendar objects to do set the dates.

Reply Children
No Data