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

Styling Custom Controls

3 Answers 93 Views
FormDecorator
This is a migrated thread and some comments may be shown as answers.
Josh
Top achievements
Rank 1
Josh asked on 21 Jan 2013, 05:50 PM
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.

3 Answers, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 24 Jan 2013, 01:15 PM
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.
0
Josh
Top achievements
Rank 1
answered on 28 Jan 2013, 02:59 PM
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.
0
Danail Vasilev
Telerik team
answered on 31 Jan 2013, 01:18 PM
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.
Tags
FormDecorator
Asked by
Josh
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Josh
Top achievements
Rank 1
Share this question
or