Introduction:
Here I will explain how to refresh or reload webpage using Jquery in asp.net.
Here I will explain how to refresh or reload webpage using Jquery in asp.net.
Description:
In previous article I explained expand textbox on focus and disable right click on image using JQuery and many articles relating to JQuery. Now I will explain how to refresh or reload webpage using JQuery in asp.net.
In previous article I explained expand textbox on focus and disable right click on image using JQuery and many articles relating to JQuery. Now I will explain how to refresh or reload webpage using JQuery in asp.net.
We
can refresh or reload webpage in different ways
We
can refresh the page by using Meta tags like as shown below
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="refresh" content="10" />
<title>Refresh or reload web Page using meta tags</title>
</head>
<body>
<form id="form1"
runat="server">
<div>
</div>
</form>
</body>
</html>
|
If
you observe above code in header section I mentioned meta tag with http-equiv attribute this
attribute will refresh the page and in that meta tag I mentioned content which is used to define time interval
to refresh webpage.
First Method
We
can refresh the page by using button click like as shown below
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>JQuery Refresh or reload web Page using asp.net</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
<script type="text/javascript" language="javascript">
$(document).ready(function()
{
$('#btnClick').click(function() {
location.reload();
})
})
</script>
</head>
<body>
<form id="form1"
runat="server">
<div>
<asp:Button ID="btnClick"
runat="server"
Text="Click"
/>
</div>
</form>
</body>
</html>
|
Third Method
Another
way to refresh the page automatically using JQuery like as shown below
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>JQuery Refresh or reload web Page using asp.net</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
<script type="text/javascript" language="javascript">
$(document).ready(function()
{
setTimeout("RefreshPage()", 10000);
})
function RefreshPage() {
location.reload();
}
</script>
</head>
<body>
<form id="form1"
runat="server">
<div>
<asp:Label ID="lbltxt"
runat="server"/>
</div>
</form>
</body>
</html>
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
8 comments :
very nice!
Hi,
Really good for beginners. I would like to point out one thing, that you have mentioned "First Method" twice.
Arun @http://www.encodedna.com
very nice . but How to Autorefresh Particular part of a webpage using Jquery in asp.net
Hi Suresh,
Its very nice your all articles.
in above i have one doubt in second one in the place location what i ned to mention?
location itself or page name.
Thank you
Kumar
Thank you so much suresh ji..
It is really heplfull..
hi suresh nice
but how to call every 10 minute call button click event
Superb..
Note: Only a member of this blog may post a comment.