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. Extending MasterPage

Extending MasterPage

Scheduled Pinned Locked Moved ASP.NET
helpquestion
3 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
    Taurian110
    wrote on last edited by
    #1

    I am trying to create a base MasterPage class that all the other MasterPages will inherit from. This base class will have some controls so the inheriting MasterPages get those controls automatically. My problem is that whenever I add controls to my base class it doesnt get added withing the "FORM" tag and I get errors like "Calendar control must be within FORM tag". What am I doing wrong? this is how I am doing it: protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); string Header = " some text "; this.Controls.Add(new LiteralControl(Header)); } but when I look at the page it is something like this: ... ... ... ... some text Any help would be appreicated. Thanks.

    N 1 Reply Last reply
    0
    • T Taurian110

      I am trying to create a base MasterPage class that all the other MasterPages will inherit from. This base class will have some controls so the inheriting MasterPages get those controls automatically. My problem is that whenever I add controls to my base class it doesnt get added withing the "FORM" tag and I get errors like "Calendar control must be within FORM tag". What am I doing wrong? this is how I am doing it: protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); string Header = " some text "; this.Controls.Add(new LiteralControl(Header)); } but when I look at the page it is something like this: ... ... ... ... some text Any help would be appreicated. Thanks.

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Find the form tag on the master page and add the controls to its collection, not to the master pages' controls collection


      only two letters away from being an asset

      T 1 Reply Last reply
      0
      • N Not Active

        Find the form tag on the master page and add the controls to its collection, not to the master pages' controls collection


        only two letters away from being an asset

        T Offline
        T Offline
        Taurian110
        wrote on last edited by
        #3

        Thanks a lot:)

        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