Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic JS in Body tag

Status
Not open for further replies.

cmhunt

Programmer
Apr 17, 2001
119
GB
Hi all

I have only ever used ASP.NET to create forms pages but now I need to make a sort of automated presentation effect. I know I need to add a Meta tag within the Head element to refresh to a new location (for example: <META http-equiv="refresh" Content="10 url=index.aspx">) but am stuck as to how to do it dynamically (I will be getting the next URL from a database so can't be hardcoded).

Any help would be gratefully appreciated.

Thanks

Chris
 
Put a literal control in the head section

<asp:Literal id="MyMeta" text="mymeta" runat="server"></asp:Literal>

Then in the code behind

string sDynamicMeta;
//make your db call and build your string.
sDynamicMeta = @"<META http-equiv="refresh" Content="10 url=index.aspx">";
MyMeta.Text = sDynamicMeta;

I believe crayboybert posted this but I am not sure, I know I got it from tek-tips.
Marty
 
Great, thanks - I'll give it a go.

Apologies for the misleading subject by the way. I know that's originally how I thought I'd have to do it! Don't know why I put it in there though!

Chris

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top