 |
| ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

January 5th, 2009, 09:03 AM
|
|
Registered User
|
|
Join Date: Oct 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Master Pages
How can I insert code before the HTML element or </head> element, if the page already uses a master.page that doesn't have a contentplaceholder already there for this purpose?
The site has about 40 or so pages that use the master.page but I need to place code just before the HTML or </head> element on a couple of pages for conversion tracking. Any ideas?
|
|

January 5th, 2009, 11:47 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
Hi there...
You can add code to the master page. Maybe you can add the thing you need only if the page that is rendered is the ones you need??
Also, this could be a better way, since when you need to add a page, you don't copy code, just add it to the master page list...
__________________
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the proof.
================================================== =========
|
|

January 6th, 2009, 09:16 AM
|
|
Registered User
|
|
Join Date: Oct 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Not entirely sure what you mean,would you have an example.
thanks.
|
|

January 6th, 2009, 11:28 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
I did this once ago, I will try to look for it. In the mean time, Can you modify the master page?? or you don't have any access to it??
I did something like: In the load event of the master page, check the url for the pagename, and then show a picture or not showing it according to that name.
__________________
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the proof.
================================================== =========
|
|

January 6th, 2009, 11:53 AM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
Hmmm. I would probably just add some form of literal to the master page that would get populated with XYZ code based upon the page the user has navigated to. This is pretty much identical to what Gonzalo is proposing.
So:
<asp:Literal Id="literal1" runat="server" />
csharp Code:
literal1.Text = <yourcode>;
hth
-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click  on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
|
|

January 7th, 2009, 04:30 AM
|
|
Registered User
|
|
Join Date: Oct 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Cheers Guys, that's kinda the way I had thought about it but wasn't sure if there was a better way to do it..
|
|

January 8th, 2009, 04:50 AM
|
|
Registered User
|
|
Join Date: Oct 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I'm getting an error in VWD, when I put the literal control where it is. This is no doubt an error caused within VWD itself as presumably the literal control can be placed anywhere.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
</head>
<body>
Last edited by micptpuser; January 8th, 2009 at 05:13 AM..
|
|
 |