Can't find an element because of FormDecorator

3 posts, 0 answers
  1. Stan
    Stan avatar
    36 posts
    Member since:
    Feb 2011

    Posted 16 May 2012 Link to this post

    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  ... />

    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?

  2. Niko
    Niko avatar
    383 posts

    Posted 16 May 2012 Link to this post

    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.

    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
  4. Stan
    Stan avatar
    36 posts
    Member since:
    Feb 2011

    Posted 16 May 2012 Link to this post

    It worked, thank you!
Back to Top