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

Removing Automatic CssClass Designation

2 Answers 82 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 23 May 2012, 05:12 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 25 May 2012, 03:56 PM
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.
0
Adam
Top achievements
Rank 1
answered on 25 May 2012, 07:06 PM
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
Tags
General Discussions
Asked by
Adam
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Adam
Top achievements
Rank 1
Share this question
or