Click here to Skip to main content
15,904,823 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<div name="divname" id="divname">
                        <asp:Literal ID="msg_disp" runat="server" /></div></td>
                </tr>


i need auto refresh in asp.net...
Posted
Comments
Member 12096671 24-Nov-15 6:42am    
how can i disable auto refresh pages in asp.net

You can simple use, AJAX or JQuery to achieve the same.
I just found one simple example exactly to what you were looking for.
Auto Load and Refresh Div every 10 Seconds with jQuery.[^]
 
Share this answer
 
Comments
veerasamrat 6-Sep-11 2:19am    
I alredy Checked this one, this one php, thats k i tried , But i want refresh div without recall page in asp.net
try this:

XML
<html>
<body>

<script type="text/javascript">
function Ajax(){
var xmlHttp;
    try{
        xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
    }
    catch (e){
        try{
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
        }
        catch (e){
            try{
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e){
                alert("No AJAX!?");
                return false;
            }
        }
    }

xmlHttp.onreadystatechange=function(){
    if(xmlHttp.readyState==4){
        document.getElementById('ReloadThis').innerHTML=xmlHttp.responseText;
        setTimeout('Ajax()',10000);
    }
}
xmlHttp.open("GET","http://www.example.com/the_page_that_contains_the_div_content",true);
xmlHttp.send(null);
}

window.onload=function(){
    setTimeout('Ajax()',10000);
}
</script>

<div id="ReloadThis">Default text</div>

</body>
</html>



hope it helps :)

for further queries comment here!
 
Share this answer
 
Comments
veerasamrat 6-Sep-11 2:28am    
I am biginer can u Do for this div please, because its showing some error near xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer


<div name="divname" id="divname">
<asp:Literal ID="msg_disp" runat="server" /></div>
Anandccd 15-Dec-12 2:53am    
This helps me a lot,thank you
But it is not working in Internet explorer.
Can you please help me out?
My mail id is anand.dhana@gmail.com
Member 12096671 24-Nov-15 6:43am    
how can i set timeout for login in asp.net
&lt;script type="text/javascript">
<!--

/*
Auto Refresh Page with Time script
By JavaScript Kit (javascriptkit.com)
Over 200+ free scripts here!
*/

//enter refresh time in "minutes:seconds" Minutes should range from 0 to inifinity. Seconds should range from 0 to 59
var limit = "0:10"

if (document.images) {
var parselimit = limit.split(":")
parselimit = parselimit[0] * 60 + parselimit[1] * 1
}
function beginrefresh() {
if (!document.images)
return
if (parselimit == 1) {
window.document.forms[0].submit();
}
else {

parselimit -= 1
curmin = Math.floor(parselimit / 60)
cursec = parselimit % 60
if (curmin != 0)
curtime = curmin + " minutes and " + cursec + " seconds left until page refresh!"
else
curtime = cursec + " seconds left until page refresh!"
window.status = curtime
setTimeout("beginrefresh()", 1000)
}

}

window.onload = beginrefresh
//-->
&lt;/script>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900