RadNumericTextBox dynamic css

2 posts, 0 answers
  1. Marcin
    Marcin avatar
    187 posts
    Member since:
    Jan 2011

    Posted 20 May 2011 Link to this post

    Hello, I'm having issue with css.
    I'm adding dynamically css with OnLoad event:
    function RequiredOnLoadHandler(sender) {
        if (sender.isEmpty()) {
            $(sender._textBoxElement).addClass("requiredEmpty");
        }
    }
    But is gone on mouse over. I'm having problem with. It automatically removes that added class. Could you help me, how to avoid removing that css class.?
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 20 May 2011 Link to this post

    Hello Marcin,

    I also faced the same issue. I suggest you to attach ClientEvent OnMouseOut and  set the CSS from there  also. Here is the sample code that I tried. Hope this helps you.

    Javascript:
    <script type="text/javascript">
    function OnMouseOut(Sender, args)
    {
          if (Sender.isEmpty())
           {
              var textBoxElement = $find("<%= txtbox.ClientID %>")._textBoxElement;
              textBoxElement.className = textBoxElement.className + " requiredEmpty";
           }
    }
    </script>

    Thanks,
    Princy.
Back to Top