Set a wrapper css class

3 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 15 Nov 2011 Link to this post

    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. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 17 Nov 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Galin
    Admin
    Galin avatar
    526 posts

    Posted 18 Nov 2011 Link to this post

    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
Back to Top