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

  • Thread starter Thread starter ntm
  • Start date Start date
N

ntm

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
 
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.
 
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.
 
Back
Top