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 2350
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: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: Aftab Ahmad |
last post by:
Hello Experts!
I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| |