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. Simple ASP.NET web control inheritance

Simple ASP.NET web control inheritance

Scheduled Pinned Locked Moved ASP.NET
csharphtmlasp-netoopquestion
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.
  • H Offline
    H Offline
    Hristiyan
    wrote on last edited by
    #1

    Hello ... I have a really, really simple scenario which i can't accomplish. 1) I have a WebControl called "BaseControl". In that WebControl i just place a panel (100px x 100px) and turn it's backcolor to green. 2) I create a second control which inherits the BaseControl. However when i place that control the green panel is not displayed. I assume that the i can't inherit the html ? Is there a way i can do this ? Is there a way i can achieve that simple inheritance ... or a workaround ?

    J 1 Reply Last reply
    0
    • H Hristiyan

      Hello ... I have a really, really simple scenario which i can't accomplish. 1) I have a WebControl called "BaseControl". In that WebControl i just place a panel (100px x 100px) and turn it's backcolor to green. 2) I create a second control which inherits the BaseControl. However when i place that control the green panel is not displayed. I assume that the i can't inherit the html ? Is there a way i can do this ? Is there a way i can achieve that simple inheritance ... or a workaround ?

      J Offline
      J Offline
      Jon Rista
      wrote on last edited by
      #2

      You can inherit code, but not markup. If you want to have a hierarchical control model, you would need to design your base controls to use either manually rendered html with helper methods that inject html rendered from child controls, or use control compositing and helper methods that allow child controls to inject their own content.

      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