Hello Telerik,
I m using something from documents to enable/diable a RadDatePicker.
the errors I get are:
1. ._onPopupButtonClickDelegate is null;
2.get__timePopupImage() is not a valid property. ( for this one I found get_popupImage() is the correct one)
3. ._onTimePopupImageClickDelegate is null
Can you please check it.
Regards,
Elton
I m using something from documents to enable/diable a RadDatePicker.
function disableDateTimePicker() |
{ |
var picker = $find("<%= RadDateTimePicker1.ClientID %>"); |
picker.get_dateInput().disable(); |
$removeHandler(picker.get_popupButton(), "click", picker._onPopupButtonClickDelegate); |
$removeHandler(picker.get__timePopupImage(), "click", picker._onTimePopupImageClickDelegate); |
} |
function enableDateTimePicker() |
{ |
var picker = $find("<%= RadDateTimePicker1.ClientID %>"); |
picker.get_dateInput().enable(); |
$addHandler(picker.get_popupButton(), "click", picker._onPopupButtonClickDelegate); |
$addHandler(picker.get__timePopupImage(), "click", picker._onTimePopupImageClickDelegate); |
} |
the errors I get are:
1. ._onPopupButtonClickDelegate is null;
2.get__timePopupImage() is not a valid property. ( for this one I found get_popupImage() is the correct one)
3. ._onTimePopupImageClickDelegate is null
Can you please check it.
Regards,
Elton
6 Answers, 1 is accepted
0
Elton
Top achievements
Rank 1
answered on 15 May 2008, 11:48 PM
come on guys,
I think this should be some bug or typo on telerik docs. Any one else run into this before?
I think this should be some bug or typo on telerik docs. Any one else run into this before?
0
Hello Elton,
Indeed it seems there are some changes to the event handler disposal logic between the two versions. Here is the modified snippet that works with the latest release:
I hope this helps.
Best wishes,
Maria Ilieva
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Indeed it seems there are some changes to the event handler disposal logic between the two versions. Here is the modified snippet that works with the latest release:
<script language=javascript type="text/javascript"> |
function pageLoad() |
{ |
timepicker = $find("<%= RadDateTimePicker1.ClientID %>"); |
imageClickDelegate = timepicker._onTimePopupImageClickDelegate; |
} |
function disable() |
{ |
timepicker.get_dateInput().disable(); |
$removeHandler(timepicker.get__timePopupImage(), "click", timepicker._onTimePopupImageClickDelegate); |
timepicker._onTimePopupImageClickDelegate = null; |
} |
function enable() |
{ |
timepicker.get_dateInput().enable(); |
$addHandler(timepicker.get__timePopupImage(), "click", imageClickDelegate); |
timepicker._onTimePopupImageClickDelegate = imageClickDelegate; |
} |
</script> |
<body> |
<form id="form1" runat="server"> |
<asp:ScriptManager ID="ScriptManager1" runat="server" /> |
<div> |
<telerik:RadDateTimePicker ID="RadDateTimePicker1" runat="server"> |
</telerik:RadDateTimePicker> |
<a href="#" onclick="enable();">enable</a> |
<a href="#" onclick="disable();">disable</a> |
</div> |
</form> |
</body> |
I hope this helps.
Best wishes,
Maria Ilieva
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Elton
Top achievements
Rank 1
answered on 20 May 2008, 02:27 AM
Hi Maria ,
I tried your code, and unfortunately it doesn't work for me.
I noticed you are using DateTimePicker and I m using DatePicker.
After some investigation, I found this code would work for me:
I enable and disable the popup button. And it seems work for me.
The only problem I have is I need to disable the DatePicker once page load. And let the enable/disable function are still working for me.
I tried to set the 'Enable' property of DatePicker and the DatePopupButton to false, but when I try to call the enable function above, the "picker._onPopupButtonClickDelegate" is null.
Any idea on this issue?
Cheers,
Elton
I tried your code, and unfortunately it doesn't work for me.
I noticed you are using DateTimePicker and I m using DatePicker.
After some investigation, I found this code would work for me:
function disableDateTimePicker(picker) |
{ |
if(picker.get_dateInput().get_enabled() == true) |
{ |
picker.get_dateInput().disable(); |
$removeHandler(picker.get_popupButton(), "click", picker._onPopupButtonClickDelegate); |
} |
} |
function enableDateTimePicker(picker) |
{ |
if(picker.get_dateInput().get_enabled() == false) |
{ |
picker.get_dateInput().enable(); |
$addHandler(picker.get_popupButton(), "click", picker._onPopupButtonClickDelegate); |
} |
} |
The only problem I have is I need to disable the DatePicker once page load. And let the enable/disable function are still working for me.
I tried to set the 'Enable' property of DatePicker and the DatePopupButton to false, but when I try to call the enable function above, the "picker._onPopupButtonClickDelegate" is null.
Any idea on this issue?
Cheers,
Elton
0
Hi Elton,
You can use the following approach, which is working correctly:
Let us know if this helps.
Kind regards,
Maria Ilieva
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
You can use the following approach, which is working correctly:
function pageLoad() |
{ picker = $find("<%= RadDatePicker1.ClientID %>"); |
picker.get_dateInput().disable(); |
$removeHandler(picker.get_popupButton(), "click", picker._onPopupButtonClickDelegate); |
imageClickDelegate = picker._onTimePopupImageClickDelegate; |
} |
function disableDateTimePicker(picker) |
{ |
if(picker.get_dateInput().get_enabled() == true) |
{ |
picker.get_dateInput().disable(); |
$removeHandler(picker.get_popupButton(), "click", picker._onPopupButtonClickDelegate); |
} |
} |
function enableDateTimePicker(picker) |
{ |
if(picker.get_dateInput().get_enabled() == false) |
{ |
picker.get_dateInput().enable(); |
$addHandler(picker.get_popupButton(), "click", picker._onPopupButtonClickDelegate); |
} |
} |
Let us know if this helps.
Kind regards,
Maria Ilieva
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Elton
Top achievements
Rank 1
answered on 20 May 2008, 11:10 PM
Thanx Maria ,
It works.
The doubt I still have is before I was using window.onload instead of pageLoad(). And in window.onload I can not use $find() (I always get null). I can only use $get().
some idea on this?
80)
It works.
The doubt I still have is before I was using window.onload instead of pageLoad(). And in window.onload I can not use $find() (I always get null). I can only use $get().
some idea on this?
80)
0
Accepted
Hello Elton,
The difference between $find and $get is that $find gets the client-side object of the control according to the new convections of MS AJAX. The function $get is accessing the DOM element of the control and is shorted form document.getElementById(). You can read more on the topic in this post.
All the best,
Maria Ilieva
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
The difference between $find and $get is that $find gets the client-side object of the control according to the new convections of MS AJAX. The function $get is accessing the DOM element of the control and is shorted form document.getElementById(). You can read more on the topic in this post.
All the best,
Maria Ilieva
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center