473,406 Members | 2,220 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,406 software developers and data experts.

Using themed css files requires a header control on the page

Hi,
I get this exception when I use a themed css file. In my web.config
file I have:
<pages theme="dRise">

and the trouble page is a master page :

<% Response.Write(Header)%>
<form id="form1" runat="server">
<div class="FormContent">
<asp:contentplaceholder id="ReportWizard" runat="server">
</asp:contentplaceholder>
</div>
</form>
<% Response.Write(Footer)%>

Header is a property returning :
"<html><head runat=""server""></head><body>"
and Footer returns:
"</body></html>"

The above code WORKS if I link the css file directely in the
masterpage, but if I use the themed css it generates the exception .
Can you help ?
thanks

Feb 21 '06 #1
5 14999
DWS
Sam,
First off your thinking is right on the money. But your masterpage should
look something like this. More later.

<head runat="server">
<title>Sam's Master Page</title>
</head>
<body class="body">
<form id="form1" runat="server">
<div>

The exception was caused by the response.write This writes directly to the
client browser so <head runat="server"> was sent directly to the client web
browser. ASP.Net could not find the head element (it was sent to client web
browser) and threw an exception "no head element to put your css theme link
in"

Also Sam please start using a code behind or <script runat="server"> script
blocks for your coding. <% %> style coding is obsolete.

Good Luck
DWS
"sa*************@googlemail.com" wrote:
Hi,
I get this exception when I use a themed css file. In my web.config
file I have:
<pages theme="dRise">

and the trouble page is a master page :

<% Response.Write(Header)%>
<form id="form1" runat="server">
<div class="FormContent">
<asp:contentplaceholder id="ReportWizard" runat="server">
</asp:contentplaceholder>
</div>
</form>
<% Response.Write(Footer)%>

Header is a property returning :
"<html><head runat=""server""></head><body>"
and Footer returns:
"</body></html>"

The above code WORKS if I link the css file directely in the
masterpage, but if I use the themed css it generates the exception .
Can you help ?
thanks

Feb 22 '06 #2
Thanks for replying.
I actually do use code-behind, except in this one off circumpstance
where I've used <% %>. But this is not the problem, isn't it ?

I understood your explanations, but does this mean I can't write the
page dynamically when using a theme ?

Feb 22 '06 #3
In article <11**********************@g44g2000cwa.googlegroups .com>,
sa*************@googlemail.com writes
Thanks for replying.
I actually do use code-behind, except in this one off circumpstance
where I've used <% %>. But this is not the problem, isn't it ?
Yes, it's exactly the problem.
I understood your explanations, but does this mean I can't write the
page dynamically when using a theme ?


No, it means that what you write dynamically gets sent to the browser
without the ASP.NET engine doing anything with it. Your problem is that
you need a <head> tag with a runat="server" attribute in a place where
the ASP.NET engine will see it.

Why are you using the Response.Write to write out a bit of static HTML?
This should go in the master file, that's what they are there for. DWS'
point was that the <% %> style of coding is a classic ASP one that has
basically no place in ASP.NET. If you add the <head runat="Server"> to
your master file, then your theme will work fine.

Hope this helps.

--
Alan Silver
(anything added below this line is nothing to do with me)
Feb 27 '06 #4
of course it would worked if I added <head runat="server"> directely
in the page ! But I can't do it this way.
all the html markups from my project are coming from a database (from
<html> to <body>, including <head runat=server>)
therefore I have to use response.write to write this html dynamically
before the rest of the page.

Is this clear ?
Do you understand my probleme now ?

Feb 27 '06 #5
In article <11**********************@v46g2000cwv.googlegroups .com>,
sa*************@googlemail.com writes
of course it would worked if I added <head runat="server"> directely
in the page ! But I can't do it this way.
all the html markups from my project are coming from a database (from
<html> to <body>, including <head runat=server>)
therefore I have to use response.write to write this html dynamically
before the rest of the page.
You don't *have* to use Response.Write, see below.
Is this clear ?
It's clear, but it's going to cause you a big problem. To apply themes,
the ASP.NET engine needs to be able to parse the <head> tag of your
document at run time. If you are pulling this tag out of a database,
then it's not going to be available at run time, so you can't apply
theme.
Do you understand my probleme now ?


I do, do you understand now why it isn't working?

It sounds like you might need to rethink the way your data is stored.
Wouldn't you be better storing key information in the database and using
that as data for the tags, rather than storing the tags themselves?

For example, if you wanted to store a title for the page, instead of
saving the following in your database...

<head>
<title>my page</title>
</head>

you would be better storing just the text of the title ("my page" in
this case) and have server-side code like this...

<head>
<title><asp:Literal ID="litTitle" runat="server" /></title>
</head>

Then your page could extract the title from the database, and just set
the Text property of the literal to it. That sounds like a more sensible
system anyway, and would allow you to add the runat="server" attribute
to your <head> tag, allowing you to use themes.

Hope this helps

--
Alan Silver
(anything added below this line is nothing to do with me)
Feb 27 '06 #6

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

Similar topics

2
by: Darryl Kerkeslager | last post by:
It seems that the only way to make themed AND classic Windows GUIs look okay with tab controls and subforms, due to the color issue, is to place a one page-no button tab control on each subform...
4
by: Jae | last post by:
I'm writing a web application that exports and imports excel files. The application gets a list of users and their info and displays it in a datagrid .The user then selects to save the file as a...
6
by: Terry Olsen | last post by:
I decided to use a tab control for my latest project. On Windows XP, the tab control itself is themed (tabs are themed), but the tab pages and any controls I put on them are not themed (except for...
0
by: Tim Marshall | last post by:
A2003. I rather like the appearance I get with windows themed controls turned on, but I'm running into an odd problem with tab controls. When I set the back style to transparent, it really isn't...
2
by: Christophe Peillet | last post by:
I have an application that works fine on localhost, but when it is deployed to a production server, I get the following error: Using themed css files requires a header control on the page. (e.g....
1
by: John | last post by:
We have a very large site which uses Page inheritence. All pages inherit from a few base classes, which in turn inherit from Page. The purpose of this is to centrally control header and footer...
0
by: VeeraLakshmi | last post by:
I am doing a project for internet control using Java,PHP and MySql.All sites should go through the proxy server only.We are giving access rights as allow or deny to the sites.If we type the...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
221
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
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,...
0
jinu1996
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...
0
tracyyun
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...
0
agi2029
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,...

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.