Redirect and refresh a page using the Meta tag

Hi

 

Many a times we have a requirement where by we want to make a pager refresh by itself at a certain interval. We may also want to redirect the page to another page after a certain amount of time. I know we can do this with the help of Asp.Net Ajax Extension’s Timer control. But that can only be used when you are using Ajax in your page and more importantly should be used when you have requirement to update some small section of the page. For this requirement we can simply use a Meta tag in the Page header.

 

To refresh the page after a certain period of time, we can use the meat tag refresh. Here is how to use the tag (The tag should be added in the Head section of the page).

<meta http-equiv="refresh" content="300">

 

The content attribute defines the time in second after which the page should refresh. So in the example the page would refresh after every 5 minutes.

To redirect the page to another page after certain time we can modify Meta tag like this.

<meta http-equiv="refresh" content="2;url=http://www.VikramLakhotia.com">

 

Here the page will be redirected to given URL after the time mentioned (2 seconds here) in the content (attribute) before URL here.

 

Vikram


Share this post   Email it

Feedback

Posted on 5/20/2008 9:26:56 PM

Hi Vikram,

Can u please tell me how to do "deleting data in xml table using class and objectdatasource". I can able to retrieve,insert and update data but cant delete...I wrote the code as follows in class file for deleting:

public void deleting(Int32 rno)
{
int j = give_index(rno);
if (j != -1)
{
ds.Tables[0].Rows[j].Delete();
ds.WriteXml(xml_path);
}

}

In the above code, it is taking "rno" as 0 for every row( it is suppose to take the "rno" cell's value but it is not taking, for updating it is taking the correct value)..

Any help please..

Please post your comments:

Name:  
Email (optional): Your email address will not be posted.
URL (optional):
Comments: HTML will be ignored, URLs will be converted to hyperlinks  
Enter the text you see in the box:
 

Copyright © 2006 - 2010 Vikram Lakhotia