To refresh/reload a page, there are many javascript ways. Here I am going to discuss about one of them. This feature is not widely available in the internet. I searched and realized!!!. The method goes thus:
ClientScript.RegisterStartupScript(GetType(),”keyString”, “javascriptString”);
string javascriptString = “<script language=’javascript’>functionToRefresh();</script>
// string keyString – this keyString serves as a key to the ‘javascriptString’. This means I can use one keystring for the same function anywhere in the code to call the page refresh javascript function.
The ‘functionToRefresh()’ should be entered in the .aspx page and the above code should be entered in the .aspx.cs. Thats it. I include these 2 snippets in any page I want to refresh. Whenever after any task is performed, if i want a page refresh I’ll iclude these 2 code pieces.
August 12, 2008 at 8:11 am |
I found your site on technorati and read a few of your other posts. Keep up the good work. I just added your RSS feed to my Google News Reader. Looking forward to reading more from you down the road!
August 14, 2008 at 6:06 am |
Your blog is interesting!
Keep up the good work!