【转】asp.net 页面刷新方法总结
ASP.NET页面刷新方法总结
先看看ASP.NET页面刷新的实现方法:
第一:
private void Button1_Click(objectsender,System.EventArgse)
{
Response.Redirect(Request.Url.ToString());
}
第二:
private void Button2_Click(objectsender,System.EventArgse)
{
Response.Write("<mce:script language=javascript><!--
window.location.href=document.URL;
// --></mce:script>");
}
第三:
private void Button3_Click(objectsender,System.EventArgse)
{
Response.AddHeader("Refresh","0");
}
第四:
privatevoidButton6_Click(objectsender,System.EventArgse)
{
//好像不对
//Response.Write("<mce:scriptlanguage=javascript><!--
window.location.reload();
// --></mce:script>");
}
第五:
<mce:script type="text/javascript"><!--
<!—
varlimit="3:00"
if(document.images)
{
varparselimit=limit.split(":")
parselimit=parselimit[0]*60+parselimit[1]*1
}
functionbeginrefresh()
{
if(!document.images)
return
if(parselimit==1)
window.location.reload()
else{
parselimit-=1
curmin=Math.floor(parselimit/60)
cursec=parselimit%60
if(curmin!=0)
curtime=curmin+"分"+cursec+"秒后重刷本页!"
else
curtime=cursec+"秒后重刷本页!"
window.status=curtimesetTimeout("beginrefresh()",1000)
}
}
window.onload=beginrefresh
// --></mce:script>
<DIVstyle="Z-INDEX:102;LEFT:408px;POSITION:absolute;TOP:232px"ms_positioning="text2D"><P><FONTsize="3">自动刷新页面</FONT></P></DIV>
第六:
<metahttp-equiv="refresh"content="300;url=target.html">
用window.location.href实现刷新另个框架页面
在写asp.net程序的时候,我们经常遇到跳转页面的问题,我们经常使用Response.Redirect,如果客户要在跳转的时候使用提示,这个就不灵光了,如:
Response.Write("<mce:script type="text/javascript"><!--
alert(‘恭喜您,注册成功!’);
// --></mce:script>");
Response.Redirect("main.html");
这时候我们的提示内容没有出来就跳转了,和Response.Redirect("main.html");没有任何区别。
这时我们采用下面代码试验
相关文档:
3个文件
code 类文件
using System;
using System.Text;
namespace ConcreteMIS.Common.Chinese
{
/// <summary>
/// 汉字拼音声母计算类
/// Write by WangZhenlong at 2003/11/29
/// </summary>
......
一、认识Web.config文件
Web.config文件是一个XML文本文件,它用来储存 ASP.NET Web 应用程序的配置信息(如最常用的设置ASP.NET Web 应用程序的身份验证方式),它可以出现在应用程序的每一个目录中。当你通过VB.NET新建一个Web应用程序后,默认情况下会在根目录自动创建一个默认的
&nb ......
如何在客户端直接调用WebService中的方法?
这里结合经验自己写一写
1.首先新建一个 ASP.NET AJAX-Enabled Web Site,这样系统为我们自动配置好了环境,这主要体现在Web.config这个文件上,如果已有网站不是ASP.NET AJAX-Enabled Web Site也可以对照修改下Web.config,也可以达到相同的效果。
2.新建一个web服务,WebSer ......
本文介绍两种ASP.Net项目中全局变量使用的方式。web.config文件 和 Gloab文件。以下分别说明:
方法一:web.config文件
——设置:
在web.config文件里添加关键字key是通过<appSettings>标记来实现的,但是appSettings标记通常放在<system.web>.....</system.web>标记外面。例:
<conf ......
第一种:需要引用com :microsoft.excel.11.0.
//生成Excel文件的代码
protected void ExportExcel()
{
Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook wb = excel.Workbo ......