473,288 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,288 software developers and data experts.

Base Page Headers

I repost this due to a mismatxh with Subject...

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

P.S.: if i put the code in Page_Load method of my base class, nothing
happens...

TIA
May 13 '06 #1
0 828

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Bill H | last post by:
I have a routine that displays 60 items (with thumbnails) per page. You can click any item and displays a new page with item details. When the user back pages it runs the query again to display all...
3
by: John Ramsden | last post by:
In a monitoring app I have written, the message summary screen refreshes itself automatically every couple of minutes via the line <meta http-equiv="Refresh" content="180">. The screen mostly...
3
by: sam | last post by:
Hello Group, Havent had luck posting it to microsoft.public.dotnet.framework.aspnet.datagridcontrol group. Excuse me for the cross posting. I have a datagrid which needs to be split into multiple...
0
by: Dave Alvarado | last post by:
I'm working on some code that gathers data from a web interface to one of our servers (classic ASP). The problem is that the site uses session variables to store login information, so to move from...
3
by: some one | last post by:
I have kind of wired problem, I using httpwebrequest to post form data to server , in the GetResponse stage a WebException occurred, after tracing the actual error that occurs on the server, I...
2
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"...
5
by: Joe Kovac | last post by:
Hi! I want to add <base target="_self"> into the header section of a aspx page. I want to do this in the code behind because I use master pages which I do not want to change directly. Thanks...
41
by: Twayne | last post by:
Hi, How would I go about "forcing" a user from one page to another? I have a very simple random question/answer entrance requirement for an e-mail form. After 3 page views most people are...
4
by: maheswaran | last post by:
Hi all, What is the base different to the flow below first $headers .="cc: 1@one.com,2@one.com,3@one.com"; mail($recipient, $subject, $adminmsg, $headers."\r\n"); Second
2
isladogs
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...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
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...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
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...
1
isladogs
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...
0
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...
1
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)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.