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

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

1 Answer 162 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 12 Feb 2014, 11:20 PM
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.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Feb 2014, 05:33 AM
Hi Jason,

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

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

JavaScript:
<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;";
        }
        else
        {
       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;";
        }
    }
</script>

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