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

Can't find an element because of FormDecorator

2 Answers 24 Views
FormDecorator
This is a migrated thread and some comments may be shown as answers.
Stan
Top achievements
Rank 1
Stan asked on 16 May 2012, 04:18 PM
By virtue of having RadFormDecorator on  the master page, the page markup changes during rendering. A button gets wrapped into <a>:
<A class=rfdSkinnedButton href="javascript:void(0)">
    <INPUT  ... />
</A>

Hiding the button in this scenario has undesired side affect. Since it is wrapped in the <a>, <a> will still render and because it has internal style padding, there will be a rectangle left on the screen. Therefore I need to find this <a> and hide it instead of my button.

At first it didn't sound a big deal, I can get the button parent:

var aTag = $("[id$='_btnConfirm']").parent();

However the decoration occurs late in the page life cycle, after document.ready() and the code above returns wrong element. It never finds <a>. 

I tried replacing document.ready() with window.load(). Sometimes if works, but it is very unstable. I don't see a way of excluding just that button from decorating, I don't want global changes. $find also didn't seem to work.

So how can I find this element?

-Stan

2 Answers, 1 is accepted

Sort by
0
Niko
Telerik team
answered on 16 May 2012, 05:06 PM
Hello Stan,

Please, try the load event of the MS Ajax Framework. You can find it in the Sys.Application namespace and use it in the following manner:
Sys.Application.add_load(function() {
//code to be executed when the controls load
});
As far as decorating the button is concerned, it is done in this way in order to provide consistency across browsers when it comes to rendering, CSS and decorating.

Hope this helps.

Regards,
Niko
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.
0
Stan
Top achievements
Rank 1
answered on 16 May 2012, 06:06 PM
It worked, thank you!
Tags
FormDecorator
Asked by
Stan
Top achievements
Rank 1
Answers by
Niko
Telerik team
Stan
Top achievements
Rank 1
Share this question
or