RadTextBox clientevent OnBlur does not work

2 posts, 0 answers
  1. Vitaly
    Vitaly  avatar
    68 posts
    Member since:
    Aug 2011

    Posted 25 Jun 2014 Link to this post

    Hi,
    I have in  my html RadTextBox:

    <telerik:RadTextBox ID="ShrtgLicAreaTextBox" runat="server" TabIndex="2" Width="300px" CssClass="textbox" MaxLength="40" Height="15px" onKeyUp="Count(this,40)" onChange="Count(this,40)" FocusedStyle-BackColor="#D4DEEC" >
    <ClientEvents OnBlur="OnBlur" />

    Here is my js for OnBlur event:

    <script type="text/javascript">
    function OnBlur(sender) {
    sender.get_styles().EnabledStyle[0] += "background-color:#FFCC99;";

    }
    </script>

    Bur for some reason when I leave textbox background color is not changing looks like OnBlur event does not work.

    Thank so much for yuor help.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 25 Jun 2014 in reply to Vitaly Link to this post

    Hi Vitaly,

    Please do the following modification in your JavaScript code snippet which works fine at my end.

    JavaScript:
    function OnBlur(sender) {
        sender.addCssClass("txt-color");
    }

    CSS:
    .txt-color
    {
        background-color : Black !important;
    }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top