Function to change backgroundcolor on datetimepicker on selected date change

2 posts, 0 answers
  1. Bill
    Bill avatar
    94 posts
    Member since:
    Aug 2006

    Posted 14 Nov 2013 Link to this post

    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
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 14 Nov 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top