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

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
 
S

Shiv Kumar

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.
 
T

Teemu Keiski

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.
 

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,763
Messages
2,569,562
Members
45,037
Latest member
MozzGuardBugs

Latest Threads

Top