This is a migrated thread and some comments may be shown as answers.

[Solved] DateTimePicker and Enable

1 Answer 133 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
John
Top achievements
Rank 2
John asked on 23 Dec 2010, 07:30 AM
Hi
I am useing the DateTimePicker.  When set Enable to false it still displays the buttons and when you click them you get the following error.

    htmlfile: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus.

If you are just using DatePicker the button is disabled.

Also the DatePicker has a ShowButton which is not an option for DateTimePicker, is it possible to implement so it is consistent with DatePicker.

Below are examples

<%: Html.Telerik().DatePickerFor(Function(model) model.ReadDate).Enable(Model.isEnabled).ShowButton(Model.isEnabled)%>
<%: Html.Telerik().DateTimePickerFor(Function(model) model.CompletedDate).Enable(Model.isEnabled)%>

Thanks

John

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 23 Dec 2010, 10:47 AM
Hello John,

 
You have hit a bug related with server-side enabling/disabling of the DateTime/Time picker UI component. I am glad to inform you that this issue is already fixed and the fix will be included in the next official release of the Telerik components for ASP.NET MVC.

For the time being you can overcome this issue with the following workaround:

#1: Wire load event:
[ASPX]:

...
.ClientEvents(events => events.OnLoad("dateTimePickerLoad"))
...

#2: call disable/enabled method in the load event handler in order to disable/enable component:
function dateTimePickerLoad(){
   $(this).data('tDateTimePicker').disable();
}

Thank you for your feedback. I will forward your suggestion, to implement show/hide configuration about calendar and time view buttons, to our developers for further consideration. Currently you can hide the buttons on load:
function dateTimePickerLoad(){
  $(this).find('.t-icon').hide()
}

Kind regards,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Date/Time Pickers
Asked by
John
Top achievements
Rank 2
Answers by
Georgi Krustev
Telerik team
Share this question
or