asp.net 如何刷新页面?

来源:百度知道 编辑:UC知道 时间:2024/05/16 04:44:34
单击刷新按钮后,如何使页面刷新?
请写出方法!

这个方法是否正确?或者有没有更好的方法。
protected void btn_Click(object sender, EventArgs e)
{
Response.Redirect(Request.Path, false);
}

不用ASP.NET.用JAVASCRIPT完全可以实现...

把以下代码另存为一个.HTM文件,就看到效果了.

<script type="text/javascript">
function ref()
{
document.execCommand("Refresh");
}
</script>
<input type="button" value="Click to Refresh" onclick="ref();">

因为页面内容少,刷新的快,会看不清,不过确实刷新了.

<input type="button" value="Click to Refresh" onclick="window.reload();">
还有一种方法,就是弄个button,Click一下只有一个空事件,但页面还是会自动从服务器下载的。就是
protected void btn_Click(object sender, EventArgs e)
{
}

<script type="text/javascript">
function ref()
{
window.reload();
}
</script>
<input type="button" value="Click to Refresh" onclick="ref();">