how do I dynamically change an html meta tag from my code behind code?

Discussion in 'ASP .Net' started by ntm, Jan 19, 2004.

  1. ntm

    ntm Guest

    I have this meta statement in the html for my aspx page:
    <meta http-equiv="Refresh" content="5">

    Rather than hard code the content as 5 I want to set it to different
    values from the aspx.vb code behind page. What's the esasiest way to
    accomplish this?

    Thanks,

    Nick
    ntm, Jan 19, 2004
    #1
    1. Advertising

  2. ntm

    Shiv Kumar Guest

    There are a few ways I would use depending on what else is going on. If you
    are calling the DataBind() method of you page at some point, in order to
    process the request, you could simply define a property for this in your
    page and then use

    <meta http-equiv="refresh" content="<%# RefreshTime %>

    Where RefreshTime is the name of the property.

    Or the other way I suppose you could do this is by calling a method instead
    of a property.

    --
    Shiv R. Kumar
    http://www.matlus.com
    Shiv Kumar, Jan 19, 2004
    #2
    1. Advertising

  3. ntm

    Teemu Keiski Guest

    Hi,

    specify the META tag with an ID and runat="server" attribute. Then declare a
    code-behind member for it (the name needs to match the ID you gave), and say
    of type System.Web.UI.HtmlControls.HtmlControl (not sure if
    HtmlContainerControl would do as META tag has no content). Via the
    Attributes property of the declared member, you could set these as you need
    to.

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist

    "ntm" <> wrote in message
    news:...
    >I have this meta statement in the html for my aspx page:
    > <meta http-equiv="Refresh" content="5">
    >
    > Rather than hard code the content as 5 I want to set it to different
    > values from the aspx.vb code behind page. What's the esasiest way to
    > accomplish this?
    >
    > Thanks,
    >
    > Nick
    Teemu Keiski, Jan 19, 2004
    #3
    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. Bruce W...1

    How to dynamically change page meta tags?

    Bruce W...1, Nov 19, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    3,793
    Saravana [MVP]
    Nov 20, 2003
  2. shruds
    Replies:
    1
    Views:
    751
    John C. Bollinger
    Jan 27, 2006
  3. Ross Culver
    Replies:
    10
    Views:
    534
    Ross Culver
    Aug 29, 2007
  4. newtodotnet
    Replies:
    0
    Views:
    652
    newtodotnet
    Feb 8, 2009
  5. Tamara
    Replies:
    2
    Views:
    109
    Michele Dondi
    Apr 7, 2004
Loading...

Share This Page