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. 2.0 UserCtrol and Styles

2.0 UserCtrol and Styles

Scheduled Pinned Locked Moved ASP.NET
questionhtmlwpfdesignsysadmin
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.
  • T Offline
    T Offline
    Tim McCurdy
    wrote on last edited by
    #1

    I'm building the proverbial "Address" control for our site. I don't want to hard-code the style attributes, but instead allow the developer to control the Styles for the Address Control just like the GridViews. However, even though I have a public proeprty of say "LabelStyle" that's of type "System.Web.UI.WebControls.Style", everytime I load it in the designer the designer complains that there is no such property on "System.Web.UI.UserControl". However, I DO see the element in the markup!

    <uc1:AddressControl ID="AddressControl1" runat="server">
    <LabelStyle CssClass="textFontLabel" />
    <EditorStyle CssClass="textFont" />
    </uc1:AddressControl>

    How can I get this to work properly? Or can this not be done with UserControls? Do I need to use a CompositeControl?

    M 1 Reply Last reply
    0
    • T Tim McCurdy

      I'm building the proverbial "Address" control for our site. I don't want to hard-code the style attributes, but instead allow the developer to control the Styles for the Address Control just like the GridViews. However, even though I have a public proeprty of say "LabelStyle" that's of type "System.Web.UI.WebControls.Style", everytime I load it in the designer the designer complains that there is no such property on "System.Web.UI.UserControl". However, I DO see the element in the markup!

      <uc1:AddressControl ID="AddressControl1" runat="server">
      <LabelStyle CssClass="textFontLabel" />
      <EditorStyle CssClass="textFont" />
      </uc1:AddressControl>

      How can I get this to work properly? Or can this not be done with UserControls? Do I need to use a CompositeControl?

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      If you want to make it work with the designer, you'll have to use a custom control (CompositeControl) instead as the design-time support for the usercontrol is limited in VS, it always looks at the base class UserControl to parse any nested elements you define in your user control.

      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