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
95
WebDateChoose dynamically limiting dates
posted

Hello,

I am using infragistics 7.2.20072.61 on a asp.net website. Currently I have a criteria list that generates controls based on the selected list. When selecting a list that has a date criteria I dynamically create a webDateChooser in code. I have a javascript function that limits the dates that a user can select and changes the color of invalid ones, but I can't seem to implement it properly in code only in html.

BLOCKED SCRIPT

 function WebDateChooser1_CalendarRenderDay(oCalendar, oDay, oEvent)
{

 var outOfRange = false;
 var min = oCalendar.MinDate;
 if(min && oDay.year <= min.getFullYear())
 {
    if(oDay.year < min.getFullYear())
       outOfRange = true;
    else if(oDay.month <= min.getMonth() + 1)
    {
       if(oDay.month < min.getMonth() + 1)
          outOfRange = true;
       else if(oDay.day < min.getDate())
          outOfRange = true;
    }
 }
 var max = oCalendar.MaxDate;
 if(!outOfRange && max && oDay.year >= max.getFullYear())
 {
     if(oDay.year > max.getFullYear())
        outOfRange = true;
     else if(oDay.month >= max.getMonth() + 1)
     {
        if(oDay.month > max.getMonth() + 1)
            outOfRange = true;
        else if(oDay.day > max.getDate())
            outOfRange = true;
     }
 }


oDay.element.disabled = false;

var len;
var Datenow = oDay.day + '/' + oDay.month + '/' + oDay.year;
for (var i=0, len=HolidayDays.length; i<len; ++i )
{
     if(HolidayDays[i] == Datenow)
     {
        oDay.element.disabled = true;
     }
}


if (oDay.dow == 0 || oDay.dow == 6)
    oDay.element.disabled = true;

oDay.element.style.color= outOfRange ? "#C0C0C0" : "Black";

}

 CODE:

   Dim DateT As New Infragistics.WebUI.WebSchedule.WebDateChooser()
                            DateT.ID = "txt" & i.ToString & strListID
                            DateT.MaxDate = GetLastBusinessDay(Today, 2)
                            DateT.MinDate = GetMinDate()
                            DateT.Value = DateT.MaxDate
                            DateT.Width = Unit.Pixel(150)
                            DateT.Attributes.Add("CalendarRenderDay", "WebDateChooser1_CalendarRenderDay();")
                            
                            tc.Controls.Add(DateT)

This doesn't work in code but if I build it in html (which isnt an option) it works :

HTML

 <igsch:WebDateChooser ID='DATE' runat='server' MinDate="2008-01-01"
                                             CalendarLayout-Culture="" OnLoad="DateChooser_Load" Editable="false" >
                                            <ClientSideEvents CalendarRenderDay="WebDateChooser1_CalendarRenderDay" />
                                        </igsch:WebDateChooser>

 

Do I need to pass in these oCalander, oDate and oEvent arguments? if so where do I get these values?

Thanks in advance! 

 

Parents Reply Children
No Data