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
相关文档:
1、在线用户列表的实现
在ASP时代,要实现一个网站的在线用户列表显示功能的惯用做法是修改global.asa文件中的:Application_Start、Session_Start和Session_End这三个函数。在ASP.NET时代,我依然这样做。但是必须注意很多问题。首先来看看最简单的代码实现:
protected void Application_Start(Object sender, EventArg ......
asp.net中显示在线用户
private static System.Threading.Timer timer;
private const int interval = 1000 * 60 * 20;//检查在线用户的间隔时间
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
public Global()
{
Initialize ......
[转]asp.net 母版页使用详解
母版页(扩展名是.master)
它的使用跟普通的页面一样,可以可视化的设计,也可以编写后置代码。与普通页面不一样的是,它可以包含ContentPlaceHolder控件,ContentPlaceHolder控件就是可以显示内容页面的区域。
代码如下:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile=" ......
1.//弹出对话框.点击转向指定页面
Response.Write(" <script>window.alert('该会员没有提交申请,请重新提交!')
</script>");
Response.Write(" <script>window.location
='http://www.51aspx.com/bizpulic/upmeb.aspx' </script>");
2.//弹出对话框
Re ......