ASP.NET Ajax实现弹出提示框,页面变灰不可点击
最近在网上看到一篇文章,讲ASP.NET ajax中的异常处理,有一部分是自定义javascript处理异常。突然想到网易邮箱中,弹出对话框,后边的页面变灰且不可点击的效果。
在网上找了一下,实现方法就是用两个层,一个层用来显示提示信息,一个层用来遮住页面;还有一个办法就是用iframe.两者的不同之处大概就在于iframe可以遮住全部的页面元素,而div则不能遮住下拉列表。
我这个例子使用的div,绝大部分引用了:http://www.cnblogs.com/Terrylee/archive/2006/11/13/Customizing_Error_Handling.html
代码如下:
Default.aspx 前台页面及javascript
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<mce:style type="text/css"><!--
#UpdatePanel1{
width: 200px; height: 50px;
border: solid 1px gray;
}
#AlertDiv{
left: 40%; top: 40%;
position: absolute; width: 200px;
padding: 12px;
border: #000000 1px solid;
background-color: white;
text-align: left;
visibility: hidden;
z-index: 99;
}
#AlertButtons{
position: absolute; right: 5%; bottom: 5%;
}
--></mce:style><style type="text/css" mce_bogus="1">
#UpdatePanel1{
width: 200px; height: 50px;
border: solid 1px gray;
}
#AlertDiv{
left: 40%; top: 40%;
position: absolute; width: 200px;
padding: 12px;
border: #000000 1px solid;
background-color: white;
text-align: left;
visibility: hidden;
z-index: 99;
}
#AlertButtons{
position: absolute; right: 5%; bottom: 5%;
} </style>
</head>
<body id="bodytag" style="margin: 0px" mce_style="margin: 0px">
<form id="form1" runat="server">
<asp:ScriptMan
相关文档:
文件上传界面既可以用Html的input file控件,又可以用FileUpload控件,只要将Html的input file控件加上runat="server",就会发现两者的功能完全是一模一样,上传的代码是共用的,不需要做任何改变。我想微软在将Html控件将成标准控件时应该只是多加了runat="server"吧。放入上述两者的任一控件后,添加一个标准的Button按钮 ......
1.//弹出对话框.点击转向指定页面
Response.Write(" <script>window.alert('该会员没有提交申请,请重新提交!')
</script>");
Response.Write(" <script>window.location
='http://www.51aspx.com/bizpulic/upmeb.aspx' </script>");
2.//弹出对话框
Re ......
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using Sy ......
Boolean fileOK = false;
String path = "D:\\";
//string path = "1.gif";
String fileExtension =
&nbs ......