Applying theme to User Control.
-
I have a User Control that has a custom property, which I want to set by a theme. The custom property is used in javascript that is injected into the page by a Page.ClientScript.RegisterStartupScript method in Page_Load. Basically I do the following : - Placed a [Themeable(true)] attribute above my user control class. - I register my user control in web.config.
<pages styleSheetTheme="Sunset">
<controls>
<add tagPrefix="UC" src="~/UserControls/MyUserControl.ascx" tagName="MyUserControl"/>
</controls>
</pages>- Placed a skin file under Sunset directory in App_Themes with content :
<UC:MyUserControl runat="server" CustomColor="#FF0000" />
At runtime everything works fine, but in the designer I keep getting the error : Error Rendering Control An unhandled exception has occured. There was an error parsing the theme: The control type "System.Web.UI.UserControl" cannot be themed. What am I missing here ? tia
-
I have a User Control that has a custom property, which I want to set by a theme. The custom property is used in javascript that is injected into the page by a Page.ClientScript.RegisterStartupScript method in Page_Load. Basically I do the following : - Placed a [Themeable(true)] attribute above my user control class. - I register my user control in web.config.
<pages styleSheetTheme="Sunset">
<controls>
<add tagPrefix="UC" src="~/UserControls/MyUserControl.ascx" tagName="MyUserControl"/>
</controls>
</pages>- Placed a skin file under Sunset directory in App_Themes with content :
<UC:MyUserControl runat="server" CustomColor="#FF0000" />
At runtime everything works fine, but in the designer I keep getting the error : Error Rendering Control An unhandled exception has occured. There was an error parsing the theme: The control type "System.Web.UI.UserControl" cannot be themed. What am I missing here ? tia