473,378 Members | 1,446 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,378 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 14993
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.