On the client side, from a drop down, on valuecahnged event, I need the year value of WebDatePicker.
I use
var date = txtDate.get_value(); GetHolidays(date.year);
but I get Thu Feb 28 00:00:00 UTC+0200 2013, which I dont know how to get the year value.
Hello drpoalim,
Thank you for posting in the community!
Data type returned by get_value() function is date type object. In order to get current year value of the date type object what I can suggest is using getFullYear() function. In your scenario it should look like as following:
var txtDate = $find("txtExpiryDate"); var date = txtDate.get_value(); GetHolidays(date.getFullYear());
var txtDate = $find("txtExpiryDate");
var date = txtDate.get_value();
GetHolidays(date.getFullYear());
Do not hesitate to contact me if you have any further questions concerning this matter.
This workshowever I want to get the value whan the dom is readyI use document.ready as I show in the code.
However $find("txtExpiryDate"); still gives me null.
It seems that the control txtExpiryDate is not ready yet on document.ready
I tried with the $ syntax, and then the control txtExpiryDate exists, bet get_value() not.
I use other controls on this functions, and I get the same problems.
GetAllHolidays(); }); function GetAllHolidays() { var txtDate = $find("txtExpiryDate"); var date = txtDate.get_value(); var year; if (date == null) date = new Date(); var year = date.getFullYear(); GetYearHolidays(year); }