Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Applying theme to User Control.

Applying theme to User Control.

Scheduled Pinned Locked Moved ASP.NET
javascriptdesignsysadminjsonhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    paper67
    wrote on last edited by
    #1

    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

    B 1 Reply Last reply
    0
    • P paper67

      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

      B Offline
      B Offline
      buaaytt
      wrote on last edited by
      #2

      I'm having the same problem and haven't got any clue yet.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups