RadDatePicker Date Entry Text Box Background Color Changes To White On Mouse Over

2 posts, 0 answers
  1. Jason
    Jason avatar
    3 posts
    Member since:
    Jul 2012

    Posted 12 Feb 2014 Link to this post

    Version 2013.1.514.40

    I am setting a background color on my RadDatePicker's date entry text box as an indicator to the user for a certain condition.  The problem is that when the cursor is hovered over this text box, the background color changes back to white.  I looked at the JavaScript object and the CSS for this control but could not find where it is setting the background color.  Does anyone have any idea why this happens?  It seems like a bug.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 Feb 2014 in reply to Jason Link to this post

    Hi Jason,

    Please  have a look into the sample code snippet to achieve your scenario.

    <telerik:RadDatePicker ID="RadDatePicker1" runat="server" ClientEvents-OnDateSelected="OnDateSelected">

    <script type="text/javascript">
        function OnDateSelected(sender, args) {
            var day = new Date();
            var date2 = day.getDate();
            var date1 = args.get_newValue().split("-")[0];
            if (date1 == date2)
           sender.get_dateInput().get_styles().EnabledStyle[0] += "background-color: red;";
           sender.get_dateInput().get_styles().HoveredStyle[0] += "background-color: red;";
           sender.get_dateInput().get_styles().FocusedStyle[0] += "background-color: red;";
           sender.get_dateInput().get_styles().EnabledStyle[0] += "background-color: Gray;";
            sender.get_dateInput().get_styles().HoveredStyle[0] += "background-color: Gray;";
            sender.get_dateInput().get_styles().FocusedStyle[0] += "background-color: Gray;";

Back to Top