473,746 Members | 2,667 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="FormCont ent">
<asp:contentpla ceholder id="ReportWizar d" runat="server">
</asp:contentplac eholder>
</div>
</form>
<% Response.Write( Footer)%>

Header is a property returning :
"<html><hea d 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 15029
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.co m" 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="FormCont ent">
<asp:contentpla ceholder id="ReportWizar d" runat="server">
</asp:contentplac eholder>
</div>
</form>
<% Response.Write( Footer)%>

Header is a property returning :
"<html><hea d 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************ **********@g44g 2000cwa.googleg roups.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************ **********@v46g 2000cwv.googleg roups.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:Lit eral 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
2090
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 that will be displayed as part of a main form's tab control, completely covering the subform's detail, and then pasting all the controls onto it. However, this is major cosmetic surgery. 1. Is there some secret way to re-attach event procedures...
4
4530
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 tab delimited file or an excel file. The application then saves the file in the correct format. The flip side is for the user to import/upload the file to the server The application must be able to import the excel file and read the contents. I...
6
1543
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 textboxes). Done a bit of googling on this subject and I found a lot of people with the same problem, but no real solution. Has anyone come up with a good way to get controls to appear themed on a tab page?
0
1769
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 transparent. I'm finding instead of one text box or a button that I'd like to have on the form "shining through" and displaying with all pages, it's as if the tab control keeps the odd colour background it generates. I originally developed the...
2
1672
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. <head runat="server" />). I am using themes and a single Master Page for the application, with the theme being set globally in the web.config file <page theme="xxx" /> is, off the top of my head, the markup, though don't quote me on that. ;-)
1
1012
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 content, as well as a custom permissions-system. All <html>, <head>, and <body> tags are generated in the parent class using writer.Write (in Render), then base.Render is called to generate the content of the subclass (each page). Unfortunately...
0
3138
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 url,first it will ask for authentication.After giving username and password,the authentication will be confirmed and if the site has access right as allow,the website will open else a page will be displayed.There we can send request mail to the...
21
34430
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 obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
221
367598
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 needs to store entire files, the preferred method is to save the file onto the server’s file-system, and store the physical location of the file in your database. This is generally considered to be the easiest and fastest way to store files. ...
0
8974
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9285
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9218
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6772
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6060
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4575
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4836
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3292
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.