RadDateTimePicker textbox border color in javascript

2 posts, 0 answers
  1. Jai
    Jai avatar
    34 posts
    Member since:
    May 2011

    Posted 18 Aug 2011 Link to this post

    Hi,

    I have requirement where i need to change the border color of RadDateTimePicker textbox and i want this through javascript.
    I mean like RadDateTimePickerTextBox.style.border = "Red".

    Can anyone tell me how can i get this for RadDateTimePicker through javascript ?

    Thanks,
    --Jai
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 23 Aug 2011 Link to this post

    Hi Jai,

    You have to use the approach described at the bottom of this help topic:

    http://www.telerik.com/help/aspnet-ajax/input_clientsidebasics.html

    You can reference the DateInput control in the clientside DateSelected handler with sender.get_dateInput().

    These are the styles that you may want to use:

    EnabledStyle
    HoveredStyle
    FocusedStyle

    SomeStyle[0] is for the inline textbox styles, while SomeStyle[1] is for the textbox CSS classes for the respective state.

     For example:
    <telerik:RadCodeBlock>
            <script type="text/javascript">
                function Load(sender) {
                    sender.get_styles().EnabledStyle[0] += "border-color: red;";
                    sender.updateCssClass();
                }
            </script>
    </telerik:RadCodeBlock>
     
    <telerik:RadDateTimePicker  ID="RDTP1" runat="server">
        <DateInput ClientEvents-OnLoad="Load"></DateInput>
    </telerik:RadDateTimePicker>


    All the best,
    Maria Ilieva
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Back to Top