how to make the user to select only mondays in the ultrawebdatechooser?
<igsch:webdatechooser id="txt_DateFrom" runat="server" nulldatelabel="" style="z-index: 104; left: 395px; position: absolute; top: 128px"> <ClientSideEvents CalendarRenderDay="_greyoutexceptmonday" CalendarValueChanging="_valuechanging" /> <CALENDARLAYOUT TitleFormat="Month" PrevMonthImageUrl="ig_cal_blueP0.gif" NextMonthImageUrl="ig_cal_blueN0.gif" /> </igsch:webdatechooser>
The following are the functions:
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
<script type="text/javascript" language="javascript" >
function _valuechanging(oCalendar, oDate, oEvent) { if (oDate.getDay() != 1) { oEvent.cancel = true; } }
function _greyoutexceptmonday(oCalendar, oDay, oEvent) { if ($(oDay.element).index() != 0) {
oDay.element.style.color = "grey";
} } </script>
No effect has been seen. The color is remained black for all days.
Hi gagani,
I am attaching a complete sample for your reference. Do not hesitate to ask if you have any questions regarding the matter.
Monday is the first column of the calendar. But the above calendarrenderday event did not grey out and everything is in black itself.
You should use ClientSideEvents-CalendarValueChanging="_calendarvaluechanging" – without the braces, and it should be working correctly. To grey out all dates, except Mondays, you could handle the CalendarRenderDay event:
function WebDateChooser1_CalendarRenderDay(oCalendar, oDay, oEvent){
if ($(oDay.element).index() != 0) {
}
This will work if Monday is the first column of the Calendar. Just change the number if it is at different index.
Let me know if this helps.
can we able to alert the user with "not-allowed" when the cursoris on other days when he tries to select?