RadFormDecorator adds its classes after ajax update

2 posts, 0 answers
  1. Massimiliano
    Massimiliano avatar
    184 posts
    Member since:
    Oct 2012

    Posted 21 Apr 2013 Link to this post

    I find out that RadFormDecorator adds its classes  rfdRoundedCorners rfdDecorated after an ajax call. Let's say I have a couple of RadTextBox and a checkbox inside a <div> wich will be ajaxified.
    I want to style the checkbox so I add RadFormDecorator.
    On the first page load, my RadTextBoxes will have just their classes: riSingle RadInput (plus eventual specific skin) When I trigger the ajax postback and the div updates the same textboxes will have rfdRoundedCorners rfdDecorated classes added by the form decorator. This may seem like an "innocent" behaviour but is not since this will change your css specificity. So if for example you override textboxes css with: html body .RadInput .riTextBox, html body .RadInputMgr  { }
    This will work on a fresh pageload but won't work anymore after the ajax update, screwing up the rendering of the textboxes.
    A quick fix is of course to add !important inside the css overrides, but I'm wondering if this behaviour is intended and if there is some easy workaround instead of using the !important clause in our css.

    Thanks in advance

  2. Danail Vasilev
    Danail Vasilev avatar
    1476 posts

    Posted 24 Apr 2013 Link to this post


    What actually the RadFormDecorator does is to go through the HTML elements on the page and set to those that can be decorated classes which in turn style the elements. Therefore it is normal when you perform a partial page update the FormDecorator to put such classes on the elements which were not initially decorated.

    Changing the appearance of controls (e.g. RadTextBox) by overriding their current CSS with custom one is a common scenario that can be done either by setting !important to the certain selector, or by making the selector more specific.

    Kind regards,
    Danail Vasilev
    the Telerik team
    Explore the entire set of ASP.NET AJAX controls we offer here and browse the myriad online demos to learn more about the components and the features they incorporate.
  3. DevCraft R3 2016 release webinar banner
Back to Top