HTML Title/Meta Attributes, ID tags, and code bloat

M

Max Metral

Hi. I want to do two simple things. First, have a title attribute that can
be set from code. Second, to have the content attribute of a meta tag also
modified from code. In summary, the trick is that I do NOT want ASP.Net
putting it's bloated ID attributes in the tags because my pages will be
bigger and every byte counts.

So if I do:

<title runat="server" id="foo">Some Default Title</title>

the output ID sticks around and gets expanded to something much longer based
on class name, etc, which I don't want.

Annoying, but not the end of the world, I can just do:

<title><asp:literal runat="server" id="foo">Some Default
Title</asp:literal></title>

However, now I'm not sure how to handle the meta tag like this, since I
can't do

<meta content="<asp:literal...etc

Thoughts?

Thanks!
--Max
 
S

Sarmad Aljazrawi

for the title, the easiest is to do this from the aspx vb file.

Dim mytitle as string = "Setting the title tag"
page.registerstartupscript("settitle","<script> document.title='"& mytitle &
"';">");

this would set the title of your document.

for the Meta tag, I don't know what meta tag you want to add, but you can
add from the aspx vb file too by using:

response.addheader("","")


regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top