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

Discussion in 'ASP .Net Web Controls' started by Max Metral, Feb 24, 2004.

  1. Max Metral

    Max Metral Guest

    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
     
    Max Metral, Feb 24, 2004
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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
    >
    >
     
    Sarmad Aljazrawi, Feb 24, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Donald Firesmith

    html tags within meta tags allowed?

    Donald Firesmith, Jan 5, 2005, in forum: XML
    Replies:
    5
    Views:
    919
    Andy Dingley
    Jan 8, 2005
  2. Salvador I. Ducros

    STL & reducing code bloat

    Salvador I. Ducros, Jul 28, 2003, in forum: C++
    Replies:
    5
    Views:
    1,606
    Howard Hinnant
    Aug 5, 2003
  3. RainBow
    Replies:
    6
    Views:
    370
  4. Steven T. Hatton

    Exceptions and object code bloat

    Steven T. Hatton, Nov 27, 2006, in forum: C++
    Replies:
    5
    Views:
    369
    =?iso-8859-1?q?Kirit_S=E6lensminde?=
    Nov 28, 2006
  5. Tony
    Replies:
    48
    Views:
    1,171
    Mathias Gaunard
    Dec 12, 2006
Loading...

Share This Page