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>
|
03:06
|
Category:
|
0
comments
Comments ( 0 )