【DIV弹出层】求在Asp.Net下好用的DIV弹出层...

sunlovesea 2009-05-09 10:41:49
我现在的做法是把一个DIV放在页面底部(位置固定 设置runat server),通过控制Div的显示与隐藏来实现编辑。
想要的效果是点击【编辑】弹出居中的DIV 带出要编辑的项(最好是背景变灰),编辑完成后点击【保存】Div消失。我用的是都是服务器端的控件。
求Asp.net下好用的代码...谢谢。

...全文
3477 25 打赏 收藏 转发到动态 举报
写回复
用AI写文章
25 条回复
切换为时间正序
请发表友善的回复…
发表回复
老青菜 2010-09-01
  • 打赏
  • 举报
回复
学习啦!
xu_119 2010-03-10
  • 打赏
  • 举报
回复
引用 15 楼 zhaoqiliang527 的回复:
引用 14 楼 wuyq11 的回复:参考 或用JQuery.jwindow实现窗口弹出

不错

+1
zzxap 2009-05-10
  • 打赏
  • 举报
回复
http://blog.csdn.net/hoolii/archive/2007/07/19/1699362.aspx
zzxap 2009-05-10
  • 打赏
  • 举报
回复
http://d.download.csdn.net/down/1185172/ysq910
http://hi.baidu.com/skydau/blog/item/e490532c18a0a6e48a1399ae.html
oec2003 2009-05-10
  • 打赏
  • 举报
回复
jquery lightbox
conan19771130 2009-05-10
  • 打赏
  • 举报
回复
jquery 有个插件可以实现你的功能
conan19771130 2009-05-10
  • 打赏
  • 举报
回复
jtip
Watson_wan 2009-05-10
  • 打赏
  • 举报
回复
ajax 吧
蝶恋花雨 2009-05-10
  • 打赏
  • 举报
回复
支持IE FF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>无标题 1</title>
<style>
body{font-size:11px; font-family:Verdana, Arial, Helvetica, sans-serif;}
a{color:#000; text-decoration:none;}
.img{border:0px;}
.black_overlay{
display: none;
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background-color: black;
z-index:1001;
-moz-opacity: 0.8;
opacity:.80;
filter: alpha(opacity=80);
}
.white_content {
display: none;
position: absolute;
top: 15%;
left: 25%;
width: 632px;
height: 445px;
border: 16px solid #FFF;
border-bottom:none;
background-color: white;
z-index:1002;
overflow: auto;
}
</style>
</head>

<body>
<p>This is the main content. To display a lightbox click <a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">here</a></p>
<div id="light" class="white_content">This is the lightbox content.
<a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">Close</a></div>
<div id="fade" class="black_overlay"></div>
</body>

</html>
惜分飞 2009-05-10
  • 打赏
  • 举报
回复
不是有控件的么??
asp。net ajax里面
nosaxw 2009-05-09
  • 打赏
  • 举报
回复
js脚本的东西不要用服务器去做。不然有的刷了。

div的控制很简单啊。 不想看见,就用style.display = 'none' 显示就用 style.display = 'block' ,如果不要回行就用 style.display = 'inline' div支持水平居中,但是不支持垂直居中。垂直居中可以通过style.padding设置上下的空位。达到居中,比如:style.padding = '20px 0px 20px 0px';就是垂直居中,且空中20px大小空位。
aoin2006 2009-05-09
  • 打赏
  • 举报
回复

后台函数执行完后 加上这句 div就隐藏了 或者直接 Visible

System.Web.UI.ScriptManager.RegisterStartupScript(Page, Page.GetType(), new Random().Next().ToString(), "hideScreen();", true);
llsen 2009-05-09
  • 打赏
  • 举报
回复
up
aoin2006 2009-05-09
  • 打赏
  • 举报
回复
<div style="left: expression(Math.abs(Math.round((window.document.body.offsetWidth - this.offsetWidth)/2)));
position: absolute; top: 40%; border: 1px solid #999999; background: #efefef;
padding: 15px; display: none; z-index: 1000;" id="divCreate">
<h3>
新建文件夹</h3>
名称:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:Button ID="btnCreateFolder" runat="server" Text="确定" OnClick="btnCreateFolder_Click"
OnClientClick="if(document.getElementById('TextBox2').value == ''){alert('文件夹名不允许为空');return false;}" />
<input type="button" id="Button2" value="取消" onclick="document.getElementById('divCreate').style.display='none';hideScreen()" />
</div>
<div id="Screen">
</div>


<style type="text/css">
#Screen
{
position: absolute;
z-index: 12;
top: 0px;
left: 0px;
background: #000000;
display: none;
filter: alpha(Opacity=50);
opacity: 0.5;
-moz-opacity: 0.5;
}

</style>



<script language="javascript" type="text/javascript">
// 获取宽度
function getWidth() {
var strWidth, clientWidth, bodyWidth;
clientWidth = document.documentElement.clientWidth;
bodyWidth = document.body.clientWidth;
if (bodyWidth > clientWidth) {
strWidth = bodyWidth + 20;
} else {
strWidth = clientWidth;
}
return strWidth;
}
//获取高度
function getHeight() {
var strHeight, clientHeight, bodyHeight;
clientHeight = document.documentElement.clientHeight;
bodyHeight = document.body.clientHeight;
if (bodyHeight > clientHeight) {
strHeight = bodyHeight + 30;
} else {
strHeight = clientHeight;
}
return strHeight;
}
// 锁屏
function showScreen() {
var Elements = document.getElementById('Screen');
Elements.style.width = getWidth() + "px";
Elements.style.height = getHeight() + "px";
Elements.style.display = 'block';
}
//解屏
function hideScreen() {
var Elements = document.getElementById('Screen');
Elements.style.display = 'none';
}
</script>
sunlovesea 2009-05-09
  • 打赏
  • 举报
回复
不过【天行健】 你的自定义控件里的可输入的文本框都是 固定的啊。通过EDialogBoxType设定,自己无法控制里面文本框。我的每个页面要修改的内容是不固定的。
zhaoqiliang527 2009-05-09
  • 打赏
  • 举报
回复
[Quote=引用 14 楼 wuyq11 的回复:]
参考
或用JQuery.jwindow实现窗口弹出
[/Quote]

不错
sunlovesea 2009-05-09
  • 打赏
  • 举报
回复
谢谢【天行健】的无私奉献,资源都不要分。哈哈
我姓区不姓区 2009-05-09
  • 打赏
  • 举报
回复
去年曾经发过一个资源,是一定自定义控件:
http://download.csdn.net/source/730236
major 2009-05-09
  • 打赏
  • 举报
回复
<script language=javascript>
ie4=(document.all)?true:false;
ns4=(document.layers)?true:false;

function toExit(){
var args=toExit.arguments;
var visible=args[0];
if(ns4){
theObj=eval("document.layers[\'"+args[1]+"\']");
if(theObj)theObj.visibility=visible;
}
else if(ie4){
if(visible=='show')visible='visible';
if(visible=='hide')visible='hidden';
theObj=eval("document.all[\'"+args[1]+"\']");
if(theObj)theObj.style.visibility=visible;
}

}


</script>
<div id=boysoft
style="HEIGHT: 80px; LEFT: 309px; POSITION: absolute; TOP: 150px; VISIBILITY: hidden; WIDTH: 180px; Z-INDEX: 1">
<table bgcolor=#666666 border=1 cellpadding=0 cellspacing=0 height=80
width=180>
<tbody>
<tr>
<td height=65 width="100%">
<table border=0 cellpadding=0 cellspacing=0 height=80 width="99%">
<tbody>
<tr>
<td height=57> <font
color=#ffffff>你看,这是一个隐藏的层,不过现在你可以看到了。<b></b></font></td>
</tr>
<tr align="center">
<td height=23 width="100%"><a
href="javascript:parent.close();">     </a><a
href="javascript:toExit('hide','boysoft')">关闭此窗口</a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<a href="javascript:toExit('show','boysoft')"><font color="#0000FF">打开隐藏层</font></a>
sojay 2009-05-09
  • 打赏
  • 举报
回复
服务器端控件用Panel
<asp:Panel runat="server">
</asp:Panel>

this.Panel1.Visible = true;
or
this.Panel1.Visible = false;
加载更多回复(5)

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧