0

I have a composite control that creates a datagrid and other components. The control has the Themeable attribute set to true:

[ToolboxData("<{0}:MyCompositeControl runat=server />")]
[Themeable(true)]
public class MyCompositeControl : CompositeControl {

In the .skin file in my theme, which is applied to the page, I have some settings for the GridView control, like

<asp:GridView runat="server" GridLines="None" CssClass="datacontrol">
  <AlternatingRowStyle BackColor="#E0F0FF" ForeColor="#333333" />
</asp:GridView>

The skin settings are applied to other gridviews in the page, but not to the one created by my composite control.

What should I do for the theme to be applied to the controls created by the composite control?

Paolo Tedesco
  • 55,237
  • 33
  • 144
  • 193

1 Answers1

0

The solution was simply to call explicitly ApplyStyleSheetSkin for the children controls in the OnLoad method:

protected override void OnLoad(EventArgs e) {
    EnsureChildControls();
    TheGridView.ApplyStyleSheetSkin(Page);
}
Paolo Tedesco
  • 55,237
  • 33
  • 144
  • 193