Hi,
I've created a class inheriting System.Web.UI.Page, and all this stuff I
was doing worked until now...
I want to setup some 'global' meta values, doing this:
I tested in my class contructor...
HtmlLink link = new HtmlLink();
link.Attributes.Add("type", "text/css");
link.Attributes.Add("rel", "stylesheet");
link.Attributes.Add("href", "~/newstyle.css");
this.Header.Controls.Add(link);
I have this error on an aspx.cs inheriting my class instead of
System.Web.UI.Page:
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
Source Error:
Line 176: link.Attributes.Add("href", "~/newstyle.css");
Line 177: this.Page.Header.Controls.Add(link);
It would be really nice if I could render all meta stuff in my base
class without calling it from page.aspx.cs...
TIA 2 2363
Try putting it in the base page's Page_Load event.
"Patxi" <pa***@yahoo.com> wrote in message
news:44**********************@news.free.fr... Hi,
I've created a class inheriting System.Web.UI.Page, and all this stuff I was doing worked until now...
I want to setup some 'global' meta values, doing this:
I tested in my class contructor...
HtmlLink link = new HtmlLink(); link.Attributes.Add("type", "text/css"); link.Attributes.Add("rel", "stylesheet"); link.Attributes.Add("href", "~/newstyle.css"); this.Header.Controls.Add(link);
I have this error on an aspx.cs inheriting my class instead of System.Web.UI.Page:
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 176: link.Attributes.Add("href", "~/newstyle.css"); Line 177: this.Page.Header.Controls.Add(link);
It would be really nice if I could render all meta stuff in my base class without calling it from page.aspx.cs...
TIA
If I put it in Page_Load(), I have no errors, but I assume that's
beacause code inside Page_Load() is not called, the meta tags aren't
rendered...
Michael Bosch wrote: Try putting it in the base page's Page_Load event. "Patxi" <pa***@yahoo.com> wrote in message news:44**********************@news.free.fr... Hi,
I've created a class inheriting System.Web.UI.Page, and all this stuff I was doing worked until now...
I want to setup some 'global' meta values, doing this:
I tested in my class contructor...
HtmlLink link = new HtmlLink(); link.Attributes.Add("type", "text/css"); link.Attributes.Add("rel", "stylesheet"); link.Attributes.Add("href", "~/newstyle.css"); this.Header.Controls.Add(link);
I have this error on an aspx.cs inheriting my class instead of System.Web.UI.Page:
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 176: link.Attributes.Add("href", "~/newstyle.css"); Line 177: this.Page.Header.Controls.Add(link);
It would be really nice if I could render all meta stuff in my base class without calling it from page.aspx.cs...
TIA
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: z. f. |
last post by:
Hi,
i have a class that is derived from System.Web.UI.Page, and this is the
class i use in my application as PageBase.
all other page classes are deriverd from my PageBase instead of the...
|
by: Mikip |
last post by:
Hi,
I have some properties that are common to all pages so I have created a base
class which every page inherits from. I now also want to use these
properties within User Controls on the page....
|
by: Craig Street |
last post by:
Hi
How do i create a base page in ASP.NET 2.0? I don't want to use master pages
as I don't need any visual inheritance.
You could do this simply in ASP.NET 1.1 by creating a base page that...
|
by: Andy |
last post by:
Hi all,
I have a site with the following architecture:
Common.Web.dll - Contains a CommonPageBase class which inherits
System.Web.UI.Page
myadd.dll - Contains PageBase which inherits...
|
by: craig.wagner |
last post by:
I have converted two ASP.NET 1.1 applications to ASP.NET 2.0. Each one
had some odd results, most of which I've been able to address. I'm
looking for some confirmation/advice.
Both applications...
|
by: Jeff User |
last post by:
Hello
I am using C#, .net1.1
Vis Studio 2003
I am using homeBase.aspx.cs page as a base for several other
aspx/aspx.cs web pages. The base page handles some operations that are
common to all...
|
by: Wade |
last post by:
Hi all,
We have created some "Base" class pages for our WebForms and UserControls.
For instance, when we create a WebForm called "WebForm1.aspx", instead of
inheriting from "System.Web.UI.Page"...
|
by: Goran Djuranovic |
last post by:
Hi all,
Is there a way to retrieve a derived class name inside a subroutine or a
function of the base class? I am trying to get some data from the database,
based on which derived class is calling...
|
by: =?Utf-8?B?SmF5IFBvbmR5?= |
last post by:
I am trying to access a Public property on a Master Page from a Base Page.
On the content pages I have the MasterType Directive set up as follows:
<%@ MasterType virtualpath="~/Master.master" %>...
|
by: =?Utf-8?B?c29uaWNt?= |
last post by:
Hi,
What is the best way of populating a repeater control from a SQL Database
using a base class. I am trying to impliment a base class that can be used
across future websites and will populate...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |