Removing Automatic CssClass Designation

3 posts, 1 answers
  1. Adam
    Adam avatar
    7 posts
    Member since:
    May 2012

    Posted 23 May 2012 Link to this post

    Hi,

    I have a method that dynamically (programmatically) creates standard HTML input checkboxes. This is on a page that uses a MasterPage in which the page I am working on is inside a "RadAjaxPanel".

    The problem is that I cannot assign the ".CssClass" property to my checkboxes because the value is overwritten with a "rfdRealInput" class. I need to assign these checkboxes a class so I can reference them using JavaScript (in particular, jQuery).

    How do I stop this overwriting of the ".CssClass" property so I can give these input checkboxes my own class?

    Thank you,

    Adam T. Carlson
  2. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    4533 posts

    Posted 25 May 2012 Link to this post

    Hi Adam,

    The RadFormDecorator needs to change the markup like this in order to provide the consistent styling of the elements. The rfdRealInput is a class added so we can easily obtain the actual element, e.g.:
    var boxes = $telerik.$(".dynamicChecboxes > .rfdRealInput");

    where dynamicChecboxes is the class added when they were created.

    For your convenience I am attaching a simple page that shows this in action. I hope this helps.


    Greetings,
    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Adam
    Adam avatar
    7 posts
    Member since:
    May 2012

    Posted 25 May 2012 Link to this post

    Marin,

    That works! What was not working was the jQuery selector I was using. I tried all of the following with unsuccessful results:

    $("input[type=checkbox]")
    $("input:checkbox")

    etc. The $(".newClassName > .rfdRealInput") is the key to getting the checkbox reference.

    Thanks a ton!

    Adam
Back to Top