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,
I am glad you have been able to resolve your issue. If you have any further questions do not hesitate to contact me!
Initialize works
thanks
As WebDatePicker is an ASP.NET control it is being initalized later than the document.ready event. What I can suggest is using the page load, or alternatively the control`s client side Initalize event in this scenario.
Feel free to contact me if you need any further support.
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); }
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.