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

Function to change backgroundcolor on datetimepicker on selected date change

1 Answer 81 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 14 Nov 2013, 11:10 AM
I have a radtextbox that I have set to change the background color on change text:
<ClientEvents OnValueChanged="ChangeBackColor" />
function ChangeBackColor(sender) {
sender.get_styles().EnabledStyle[0] += "background-color: lemonchiffon;";
sender.updateCssClass(); }

I have a combobox that does the same thing:

OnClientSelectedIndexChanged="ChangeBackColorCombo"

function ChangeBackColorCombo(sender, args) {
var inputElement = sender.get_inputDomElement();
inputElement.style.backgroundColor = "lemonchiffon";
}

Is there an equvalent to this for a datetime picker? I cant find the function that reference the input or textbox of the control to change it on a selected date change.
Thanks

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 14 Nov 2013, 12:07 PM
Hi Bill,

Please have a look into the code snippet to change the background color of RadDatePicker.

ASPX:
<telerik:RadDatePicker ID="RadDatePicker1" runat="server">
    <DateInput ClientEvents-OnValueChanged="ValueChanged">
    </DateInput>
</telerik:RadDatePicker>

JavaScript:
<script type="text/javascript">
    function ValueChanged(sender, args) {
        sender.get_styles().EnabledStyle[0] += "background-color: red;";
        sender.updateCssClass();
    }
</script>

Thanks,
Shinu.
Tags
Calendar
Asked by
Bill
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or