This is a migrated thread and some comments may be shown as answers.

RadFormDecorator adds its classes after ajax update

1 Answer 55 Views
FormDecorator
This is a migrated thread and some comments may be shown as answers.
Massimiliano
Top achievements
Rank 1
Massimiliano asked on 21 Apr 2013, 03:28 PM
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


1 Answer, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 24 Apr 2013, 10:50 AM
Hi,

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.
Tags
FormDecorator
Asked by
Massimiliano
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Share this question
or