I have a couple raddatepicker controls that are not enabled correctly after I've set date1.enabled = true
.
The master page contains a client side function that sets disabled controls to readonly:
function ParseDocumentForDisabled() {
//Transform the disabled controls that are not inside a DIV
$("input[type=text][disabled]").each(function (i, v) {
if ($(v).attr('OnClientLoad') != '' && $(v).attr('OnClientLoad') != undefined)
return;
$(v).removeAttr("disabled");
$(v).attr("readonly", "");
});
//Transform the disabled DIVs
$("div[disabled]").each(function (i, v) {
$(v).removeAttr("disabled");
//Take each control type and parse it
$(v).find("input[type=text]").attr("readonly", "");
$(v).find("textarea").attr("readonly", "");
$(v).find("checkbox").attr("disabled", "disabled");
$(v).find("input[type=submit]").attr("disabled", "disabled");
$(v).find("input[type=button]").attr("disabled", "disabled");
});
}
The controls are in a radwindow popup and linked to the event of a radcombobox change, however, after the combobox event sets either raddatepicker's enabled property to true after being disabled, only the calendar icon becomes usable again, the textarea remains readonly.
Thank you for your help. Iris
[edit]
Managed to fix the issue by setting date1.dateinput.enabled = true
. The problem was that the textarea remained readonly instead of being disabled and the jquery didn't activate it properly.
Use the client-side API provided by the control (http://www.telerik.com/help/aspnet-ajax/calendar-client-side-rad-datepicker.html), as it is much more than the collection of HTML, so enabling it has to enable other features and code. Here is what worked for me:
Here is also an approach that does not depend on knowing the ID of the control - it goes through all disabled HTML elements on the page, check if an IScriptControl is associated with them and whether it has the set_enabled() API and then calls it. Since date pickers are composite controls, the actual date input is disabled, and you also have to enable its parent - the date picker, hence the second nested if.