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

ASP.NET meta head

GTi
When i Use
HtmlHead head.Title
I can change the <title> of a webpage from codebehind.
But I need to add <meta>, <link href=> an <script src=> also from
codebehind.

Nov 29 '05 #1
2 1201
For script blocks u can use Page.RegisterStartupScript.. for link href u may
prefer asp style construction. For instance, MyVariable must be (at least)
protected variable/property...

<link href="<%=MyVariable%>"

But it is not recommended.. Try to remove your dependencies. Codebehind is
to remove this tightly coupled connections between Design and
Implementation...
--
HTH

Thanks,
Yunus Emre ALPÖZEN
BSc, MCSD.NET

"GTi" <tu****@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
When i Use
HtmlHead head.Title
I can change the <title> of a webpage from codebehind.
But I need to add <meta>, <link href=> an <script src=> also from
codebehind.

Nov 29 '05 #2
There's a new HtmlLink class that writes the link element into the head but
there does not appear to be an equivalent for writing a script element into
the head. I'm using this...

#region Write JavaScript <script> Element External File Reference...

// Define an arbitrary but unique name to use as a key
String key = "ExternalJavaScriptReference";
String url = Request.ApplicationPath + "/Scripts/scripts.js";

// Instantiate ClientScript object
ClientScriptManager cs = Page.ClientScript;

// Do not register if this instance of the key is already registered
already.
if (!cs.IsClientScriptIncludeRegistered(key))
{
// Write <script> element into body of the page
cs.RegisterClientScriptInclude(key, url);
}
#endregion

That writes the <script> element into the body and as far as I can tell
provides the same functionality as it were in the head noting I'd like to
know the difference if any.
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/


"Yunus Emre ALPÖZEN [MCSD.NET]" <yemre> wrote in message
news:Oo***************@TK2MSFTNGP15.phx.gbl...
For script blocks u can use Page.RegisterStartupScript.. for link href u
may prefer asp style construction. For instance, MyVariable must be (at
least) protected variable/property...

<link href="<%=MyVariable%>"

But it is not recommended.. Try to remove your dependencies. Codebehind is
to remove this tightly coupled connections between Design and
Implementation...
--
HTH

Thanks,
Yunus Emre ALPÖZEN
BSc, MCSD.NET

"GTi" <tu****@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
When i Use
HtmlHead head.Title
I can change the <title> of a webpage from codebehind.
But I need to add <meta>, <link href=> an <script src=> also from
codebehind.


Nov 29 '05 #3

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

Similar topics

1
by: Darren Blackley | last post by:
Hi there I have documents that I want to automatically add additional meta tags to. The documents already have some meta tags and I want to keep them all together, so I want to add my new meta tags...
3
by: J1C | last post by:
How can I programatically add meta tags with javascript?
5
by: RodneyDunes | last post by:
My site did validate and now it doesn't. The error I get is the following: document type does not allow element "META" here ....nt-type" content="text/html;charset=iso-8859-1"> Can someone...
2
by: localhost | last post by:
I have these in all of my pages: <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name=vs_defaultClientScript...
1
by: Maziar Aflatoun | last post by:
Hi everyone, My goal is to modify the contents of my meta tag (html refresh). However, my code adds a new instance of the meta tag at the bottom of the page. Is there a way to modify it instead...
4
by: clintonG | last post by:
Anybody know how to dynamically write the meta tags using code so they are formatted on a separate line in the HTML source? Preferred or optimal framework classes that may be used in this regard? ...
6
by: Fred Nelson | last post by:
Hi: I'm developing a new C# Web App and I'm hoping to find a way that I can dynamically generate meta tags for the search engines at the page level. (I want to do this so that I can have someone...
1
by: joeblast | last post by:
Can someone explain to me why the META Refresh doesn't work in an ASP.NET page? It works just fine in my old asp one! Content value has to be in quotes if not otherwise I get a warning. ...
3
by: Rick | last post by:
I have a base class that inherits from System.Web.UI.Page that I need to include the ability to read the inheriting class/page meta tags. I can't find any methods in the System.Web.UI.Page members...
2
by: Bill Nguyen | last post by:
The HTML doc looks like this: <HTML xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> <HEAD> <META NAME="Generator" CONTENT="Microsoft MapPoint 2004">
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.