Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 5th, 2009, 09:03 AM
Registered User
 
Join Date: Oct 2007
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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?
Reply With Quote
  #2 (permalink)  
Old January 5th, 2009, 11:47 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

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.
================================================== =========
Reply With Quote
  #3 (permalink)  
Old January 6th, 2009, 09:16 AM
Registered User
 
Join Date: Oct 2007
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Not entirely sure what you mean,would you have an example.

thanks.
Reply With Quote
  #4 (permalink)  
Old January 6th, 2009, 11:28 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

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.
================================================== =========
Reply With Quote
  #5 (permalink)  
Old January 6th, 2009, 11:53 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

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."
===============================================
Reply With Quote
  #6 (permalink)  
Old January 7th, 2009, 04:30 AM
Registered User
 
Join Date: Oct 2007
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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..
Reply With Quote
  #7 (permalink)  
Old January 8th, 2009, 04:50 AM
Registered User
 
Join Date: Oct 2007
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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..
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Master Pages Jayahar ASP.NET 3.5 Basics 1 September 2nd, 2008 04:20 PM
Master Pages, Content Pages and CSS carliviris Visual Studio 2005 0 January 8th, 2008 05:56 PM
Master pages wunnavabk ASP.NET 2.0 Professional 1 June 25th, 2007 07:09 AM
META tags and master pages thenoseknows ASP.NET 2.0 Professional 1 October 9th, 2006 01:02 PM
detail-master pages katie456 Classic ASP Databases 1 June 13th, 2003 04:16 AM



All times are GMT -4. The time now is 12:25 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.