Styling Custom Controls

4 posts, 0 answers
  1. Josh
    Josh avatar
    3 posts
    Member since:
    Oct 2012

    Posted 21 Jan 2013 Link to this post

    Is there a way to get FormDecorator to style custom controls i have on my page? They are just modified DropDownList controls but the FormDecorator doesn't pick them up.
  2. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1494 posts

    Posted 24 Jan 2013 Link to this post

    Hi Josh,

    RadFormDecorator is supposed to decorate standard HTML elements and ASP controls that are list in this help article.

    What RadFormDecorator initially does is to locate any HTML elements/controls on the page/zone which can be decorated and apply to them the appropriate classes (you can find the list of the CSS classes that RadFormDecorator adds here). They, in turn, add the needed image sprites, backgrounds, positions, etc.

    If you have set the class attribute of the HTML elements or CssClass property to the server controls they will not be decorated. Therefore you can try removing these classes. If that does not help, could you give more information about your custom control:
    • Is this a User Control or a new server control
    • how do you load it and on which page phase, etc ? 
    • Which elements of the control do you want to decorate?


    Kind regards,
    Danail Vasilev
    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. UI for ASP.NET Ajax is Ready for VS 2017
  4. Josh
    Josh avatar
    3 posts
    Member since:
    Oct 2012

    Posted 28 Jan 2013 Link to this post

    They are server controls that inherent from DropDownList
    public abstract class DataCCDropDownList : System.Web.UI.WebControls.DropDownList


    They are added to the aspx markup as following
    <cc1:DataCCDropDownList runat="server" ID="ccAddrTypeCd"></cc1:DataCCDropDownList>

    All I want is these controls to be styled just like the other drop downs i have on the page.
  5. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1494 posts

    Posted 31 Jan 2013 Link to this post

    Hi Josh,

    As I have already said in my previous post:
    • RadFormDecorator styles standard HTML elements and ASP controls that are included in this help article.
    • HTML elements having their class attribute set and server controls having their CssClass property set will not be decorated. You can try removing these classes from the HTML elements/Server control.

    Decoration of custom controls is out of the scope of RadFormDecorator.

    Nevertheless I have created a simple server-control that inherits DropDownList and it seems that RadFormDecorator is decorating it properly. I have attached my VS sample along with the custom server-control in the attached archive. As you can see in the video there - once a custom class is added to the control RadFormDecorator will no longer pick it up and this is the expected behavior.

    Kind regards,
    Danail Vasilev
    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.
Back to Top