[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webcontrols

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

Max Metral

2/24/2004 12:41:00 AM

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


1 Answer

Sarmad Aljazrawi

2/24/2004 6:13:00 PM

0

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
--
Sarmad Aljazrawi
B.Sc. Computer Science, MSDBA, MCP
www.aljazrawi.net


"Max Metral" <memetral@hotmail.com> wrote in message
news:WKednREMs-wqAKfd4p2dnA@speakeasy.net...
> 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
>
>