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

Set a wrapper css class

2 Answers 167 Views
Input
This is a migrated thread and some comments may be shown as answers.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 16 Nov 2011, 12:23 AM
If I inherit from the RadTextBox (to make my own server control), how can I specify a new class on the root "RadInput RadInput_Default" level?

this.CssClass seems to style just the input control.

2 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 17 Nov 2011, 03:20 PM
Hello,

You can achieve this thing by using jQuery.

<script type="text/javascript">
 
        $(document).ready(function () {
 
            $('span[class$="RadInput RadInput_Default"]').addClass("MyCss");
        });
 </script>
<style type="text/css">
        .MyCss
        {
            background-color: Red;
        }
    </style>

Note : Don't forget to add jQuery reference in Head tag.
Please check final-output image.

Sorry, for result image. by mistake it was added by me.

Thanks,
Jayesh Goyani
0
Galin
Telerik team
answered on 18 Nov 2011, 04:49 PM
Hi Jayesh Goyani,

The suggestion of Jayesh Goyani works well, however you can also use our new property WrapperCssClass, which sets a CssClass on the root level and is added in version Q3 2011.

I hope this helps.

Kind regards,
Galin
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
Tags
Input
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Jayesh Goyani
Top achievements
Rank 2
Galin
Telerik team
Share this question
or