Change CSS from javascript

5 posts, 0 answers
  1. Jon
    Jon avatar
    813 posts
    Member since:
    Oct 2008

    Posted 29 Jan 2015 Link to this post

    Hi,

    On validation fail I would like to switch the css class of the raddropdowntree in order to end up with a red border.  

    I am trying the following but not sure if it is my code or the css that is to blame. Any suggestions?

                 
                        function RadDropDownTree_ValidationStyleSetter(textBox, eventArgs) {
                            if (eventArgs.IsValid === false) {
                                textBox.addCssClass('RadDropDownTreeFieldErrorHighlight');
                            } else {
                                textBox.removeCssClass('RadDropDownTreeFieldErrorHighlight');
                            }
                        }

    Regards

    Jon


  2. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 03 Feb 2015 Link to this post

    Hello Jon,

    You can use jQuery and the rddtInner selector, in order to manage the css of the controls by adding and removing a custom css class. This class should have the border-color set to red. In the attachment, you can find a simplified runnable sample demonstrating the implementation of the suggested approach at the change event of a checkbox.

    Regards,
    Nencho
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jon
    Jon avatar
    813 posts
    Member since:
    Oct 2008

    Posted 03 Feb 2015 in reply to Nencho Link to this post

    Hi Nencho,

    Many thanks for that.  A very helpful mechanism.

    Do you know if there is any movement towards having a more integrated set of validation mechanisms built into the various editor controls?

    Best Regards

    Jon



  5. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 06 Feb 2015 Link to this post

    Hello Jon,

    I am afraid that there probably won't be any further implementations regarding the validation of the controls as this implementation might differ in some scenarios. This is why we leave the ability for custom handling of the validation scenario.

    Regards,
    Nencho
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. Jon
    Jon avatar
    813 posts
    Member since:
    Oct 2008

    Posted 06 Feb 2015 in reply to Nencho Link to this post

    Ah OK,

    Not to worry :)
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017