locked
Designer exception RRS feed

  • Question

  • User1297648701 posted

    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

    Wednesday, April 14, 2010 1:39 PM

All replies

  • User614805505 posted

    Dear paperke67,

    - Placed a [Themeable(true)] attribute above my user control class.

    The above attribute should apply on properties.

    Pls refer :

    http://msdn.microsoft.com/en-us/magazine/cc163711.aspx

    Thursday, April 15, 2010 12:10 AM
  • User-438128674 posted

    I get the same error at design time after theming a UserControl and I don't think it has anything to do with the [Themeable(true)] attribute applied to the class. Here is a quote from msdn:

    [AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Property)]
    public sealed class ThemeableAttribute : Attribute
    

     

    Can anyone from Microsoft Team come back on it?

    Tuesday, February 28, 2012 12:43 PM