473,402 Members | 2,072 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

How do i refer to "<META ..." in code?

Hi. I'm trying to get one of the examples from ASP.NET 1.1 Insider
Solutions to work in asp.net and i'm getting stuck on using the META
tage to do a refresh.

I have the following in my HTML behind my aspx web form but the ID=..
is generating an error - "Could not find any attribute 'id' of element
'meta'."

<meta id="mtaRefresh" runat="server" />

If I have no ID how can I refer to the tag in my code? I want to do
the following:

Dim myMeta As HtmlControls.HtmlGenericControl
myMeta = Page.FindControl("mtaRefresh")
myMeta.Attributes.Add("http-equiv", "refresh")
myMeta.Attributes.Add("content", "0;url=" & sRefreshURL)

I've tried using name="mtaRefresh" but just get no object returned by
the FindControl.

Any suggestions are more than welcome but I'm quite a newcomer to asp.
Nov 18 '05 #1
6 1768
Not sure why yours doesn't work, but try this: inside <head> add a "literal"
control with id= and runat= and set its text to your "<meta ...>".

Bill

"Pealy" wrote:
Hi. I'm trying to get one of the examples from ASP.NET 1.1 Insider
Solutions to work in asp.net and i'm getting stuck on using the META
tage to do a refresh.

I have the following in my HTML behind my aspx web form but the ID=..
is generating an error - "Could not find any attribute 'id' of element
'meta'."

<meta id="mtaRefresh" runat="server" />

If I have no ID how can I refer to the tag in my code? I want to do
the following:

Dim myMeta As HtmlControls.HtmlGenericControl
myMeta = Page.FindControl("mtaRefresh")
myMeta.Attributes.Add("http-equiv", "refresh")
myMeta.Attributes.Add("content", "0;url=" & sRefreshURL)

I've tried using name="mtaRefresh" but just get no object returned by
the FindControl.

Any suggestions are more than welcome but I'm quite a newcomer to asp.

Nov 18 '05 #2
You can user Response.AppendHeader("Refresh", "10; URL=.aspx") to add anything to meta tag. For more details refer this article,
http://www.extremeexperts.com/Net/Ar...onTimeout.aspx

--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com
"Pealy" <pe****@bigfoot.com> wrote in message news:68**************************@posting.google.c om...
Hi. I'm trying to get one of the examples from ASP.NET 1.1 Insider
Solutions to work in asp.net and i'm getting stuck on using the META
tage to do a refresh.

I have the following in my HTML behind my aspx web form but the ID=..
is generating an error - "Could not find any attribute 'id' of element
'meta'."

<meta id="mtaRefresh" runat="server" />

If I have no ID how can I refer to the tag in my code? I want to do
the following:

Dim myMeta As HtmlControls.HtmlGenericControl
myMeta = Page.FindControl("mtaRefresh")
myMeta.Attributes.Add("http-equiv", "refresh")
myMeta.Attributes.Add("content", "0;url=" & sRefreshURL)

I've tried using name="mtaRefresh" but just get no object returned by
the FindControl.

Any suggestions are more than welcome but I'm quite a newcomer to asp.

Nov 18 '05 #3
Thanks Saravana - I tried what you suggested and it doesn't cause any
errors but seems to have no effect whatsoever.

I added the lines to my Page_load (see below) but while the pnlWait is
shown okay there's no refresh and the LoadArtistTree() therefore never
called.

Any Ideas? I've tried it both inside and outside frames but this seems
to make no difference at all.

N.

Private Sub Page_Load(ByVal sender .....

If IsPostBack Then
' do nothing
Else

Dim sCustID As String = Request.QueryString("custID")
If sCustID > "" Then
LoadArtistTree()
Else
Dim sRefreshURL As String = Request.Url.ToString() & "?custID=1"
Response.AppendHeader("HTTP-EQUIV", "Refresh")
Response.AppendHeader("CONTENT", "2; URL=" & sRefreshURL)
pnlwait.Style("top") = 1
pnlwait.Visible = True

End If
End If
P.S - Replacing the response.appendheader lines with the following DOES
cause a refresh but that's not what I want to do.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #4
Hi Bill - apologies but I'm obviously a bit less advanced than I need to
be. I've no idea what a literal control is and as for adding a control
to a <head>??? If you could maybe elaborate I'd love to give it a try -
especially if there's a way of doing it from code as what I'm trying to
achieve is a 'pleas wait' type thing which shows the message while a big
tree is loading.

Thanks.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #5
In this case, Saravana's suggestion is way better than mine, but here's what
I mean:

Your html by default has <head></head>, with a bunch of stuff in between.
Insert a control somewhere in there, e.g.
<HEAD>
... other stuff
<asp:literal id="litControl" runat="server"></asp:literal>
... other stuff
</HEAD>

Then, in Page Load, something like: litControl.Text = "<title>My Page
Title</title>"

This will dynamically change the title of your window. You could also insert
<meta> tags with your refresh stuff, etc.

hth,

Bill

"Neil Smith" wrote:
Hi Bill - apologies but I'm obviously a bit less advanced than I need to
be. I've no idea what a literal control is and as for adding a control
to a <head>??? If you could maybe elaborate I'd love to give it a try -
especially if there's a way of doing it from code as what I'm trying to
achieve is a 'pleas wait' type thing which shows the message while a big
tree is loading.

Thanks.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #6
Hi Bill , thanks again,

Do you mean I can add stuff like this to a literal control? It doesn't
have to be a a <META> tag?

litControl.Attributes.Add("http-equiv", "refresh")
litControl.Attributes.Add("content", "0;url=" & sRefreshURL)

Neil.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Ensoul Chee | last post by:
I used #include <iostream.h> int m; cout << "Hexadecimal == 0x" << hex << m << endl; to print value of m in hexadecimal mode. But I got the compile error like this couttest.cpp:20 `hex'...
1
by: Christian Schmidbauer | last post by:
Hello! I prepare my XML document like this way: ------------------------------------------------------- PrintWriter writer; Document domDocument; Element domElement; // Root tag
7
by: Diandian Zhang | last post by:
Does anyone have an idea, how to do it? Thanks in advance!
10
by: Udi Zisser | last post by:
Hello, any idea why this does not work? or how do i get this thing to work? <BASE HREF="http://localhost/thedude/"> <META HTTP-EQUIV="Refresh" CONTENT="0; URL=redirect.html"> I'm adding...
4
by: wangzhihuii | last post by:
Hi all, I'm really confused, can cout<<""; contribute anything to the routine ?!! my programm won't work properly without this trivial sentence. Sincerely vivian
4
by: Don Wash | last post by:
Hi All! I'm getting the following Error: No DLLs has been compiled yet and nothing in the \bin directory. So it is not the versioning problem or anything like that. And here are the...
3
by: George Durzi | last post by:
I'm using the following tag to refresh my page every 3 minutes. <meta http-equiv="refresh" content="180; URL=default.aspx"> However, it's bound to happen that a user is working on the page, and...
2
by: andrew007 | last post by:
I do xml / xslt transformation using asp.net but I found any value (w/xml format) in xml node html-encoded to &lt and &gt format if it's > or < tag. Since I have sub xml data in a parent xml node...
1
by: ismailc | last post by:
Hi, I need help please. Update system to to new version & moved on to .Net2 But now my code that worked in my .Net1 xslt does not work. .Net1 fine: <xsl:stylesheet...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.