Extending MasterPage
-
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. -
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.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
-
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
Thanks a lot:)