Asp.net"页面加载中"效果实现(转)
在网上找了好多,实现方式大多是使用定时器
个人觉得定时器会造成一定程度上的假象
(如:定时器还没结束页面已经加载完毕,或定时器结束后页面还没加载完成)
本方法利用的是javascript,先网页面里面写入一个层,显示加载框,然后等页面结束后
在body的onload中写入事件,隐藏该对话框
方法(我的系统是多个页面,所以写了一个公用的类common.cs):
在类里面加入如下函数(也可在每个代码后文件中写入):
#region "页面加载中效果"
/// <summary>
/// 页面加载中效果
/// </summary>
public static void initJavascript()
{
HttpContext.Current.Response.Write(" <mce:script language=JavaScript type=text/javascript><!--
");
HttpContext.Current.Response.Write("var t_id = setInterval(animate,20);");
HttpContext.Current.Response.Write("var pos=0;var dir=2;var len=0;");
HttpContext.Current.Response.Write("function animate(){");
HttpContext.Current.Response.Write("var elem = document.getElementById('progress');");
HttpContext.Current.Response.Write("if(elem != null) {");
HttpContext.Current.Response.Write("if (pos==0) len += dir;");
HttpContext.Current.Response.Write("if (len>32 || pos>79) pos += dir;");
HttpContext.Current.Response.Write("if (pos>79) len -= dir;");
HttpContext.Current.Response.Write(" if (pos>79 && len==0) pos=0;");
HttpContext.Current.Response.Write("elem.style.left = pos;");
HttpContext.Current.Response.Write("elem.style.width = len;");
HttpContext.Current.Response.Write("}}");
HttpContext.Current.Response.Write("function remove_loading() {");
HttpContext.Current.Response.Write(" this.clearInterval(t_id);");
HttpContext.Current.Response.Write("var targelem = document.getElementById('loader_container');");
HttpContext.Current.Response.Write("targelem.style.display='none';");
HttpContext.Current.Response.Write("targelem.style.visibility='hidden';");
HttpContext.Current.Response.Write("}");
HttpContext.Current.Response.Write("
// --></mce:script>");
HttpContext.Current.Response.Write("<mce:style><!--
"
相关文档:
ASP.NET 提供三种用于在出现错误时捕获和响应错误的主要方法:Page_Error 事件、Application_Error 事件以及应用程序配置文件 (Web.config)。
如果您不调用 Server.ClearError 或者捕获 Page_Error 或 Application_Error 事件中的错误,则将根据 Web.config 文件的 <customErrors> 部分中的设置处理错误。在 & ......
SqlDataSource 控件可对它检索过的数据进行缓存,这样可以避免再次运行资源消耗量较大的查询,从而提高应用程序的性能。缓存主要用于数据变化不频繁的情况。
此外,当通过 System.Data.SqlClient 提供程序使用 SqlDataSource 控件时,可以使用 SqlCacheDependency 对象。这样可使 SqlDat ......
ObjectDataSource 控件基于 SelectMethod、InsertMethod、UpdateMethod 或 DeleteMethod 属性中所标识的方法名称以及组成业务对象方法签名的参数名来调用业务对象方法。在业务对象中创建方法时,必须确保业务对象方法所接受的参数名和类型与 ObjectDataSource 控件传递的参数名和类型匹配。(参数顺序并不重要。)
  ......
通过Asp.net(C#)应用程序读取本地上传的Excle文件,存放到DataSet中,通过DataSet中的方法直接生成XML文件.
C# Code
if (this.FileUpload1.PostedFile != null)
{
string filename = this.FileUpl ......