弹出层 大家讨论 页面上有个 datalist 我放了一个 linkbutton 编辑铵扭 当我点击的时候 弹出当前点击的ID的数据 并进行编辑 大家怎么实现 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 微软的ajax组件有弹出的控件,你下个ajax的组件,开发时实现一些功能就容易多了 用js 显示 或隐藏 Div <asp:DataList ID="DataList1" runat="server"> <ItemTemplate> <asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton> <div id = "MyDiv" style="display:none"><%#DataBinder.Eval(Container.DataItem,"ID"%></div> </ItemTemplate> </asp:DataList> linkbutton 事件里写类似Response.Write("alert('something')")的语句 JS弹出对话框:Prompt我是这么实现的,不过这个方法有一点不好,弹出的位置不能固定 要不这样做。点击linkbutton时用windows.open()打开一个没有地址栏,没有状态栏的子窗口. 将ID传过去.在打开的页面上进行详细资料的修改,修改完成,自动返回到上一页面,并关闭。父页面:点击linkbutton时打开另一页面 window.open(url,'更新','width=720,Height=550,scrollbars=yes,resizable=yes');子页面修改完成:Response.Write("<script>alert('修改成功')</script>");Response.Write("<script>window.opener.location=window.opener.location; window.close();</script>"); 点击LinkButton把数据绑定到层里下面是让父窗口不可编辑的代码<html><head> <script> function locking(){ document.all.ly.style.display="block"; document.all.ly.style.width=document.body.clientWidth; document.all.ly.style.height=document.body.clientHeight; document.all.Layer2.style.display='block'; } function Lock_CheckForm(theForm){ document.all.ly.style.display='none';document.all.Layer2.style.display='none'; return false; } </script></head><body> <img src="http://powereasy.net/skin/since07/images/sf_cms_banner1.jpg"> <p align="center"> <input type="button" value="系统锁定" onclick="locking()"> </p> <div id="ly" style="position: absolute; top: 0px; filter: alpha(opacity=60); background-color: #777; z-index: 2; left: 0px; display: none;"> </div> <!-- 浮层框架开始 --> <div id="Layer2" align="center" style="position: absolute; z-index: 3; left: expression((document.body.offsetWidth-540)/2); top: expression((document.body.offsetHeight-170)/2); background-color: #fff; display: none;" > <table width="540" border="0" cellpadding="0" cellspacing="0" style="border: 0 solid #e7e3e7; border-collapse: collapse"> <tr> <td style="background-color: #73A2d6; color: #fff; padding-left: 4px; padding-top: 2px; font-weight: bold; font-size: 14px;" height="27" valign="middle"> [ 警 告 ] </td> </tr> <tr> <td height="130" align="center"> <input type="button" value=" 确定 " onclick="Lock_CheckForm(this);"> </td> </tr> </table> </div> <!-- 浮层框架结束 --></body></html> LinkButton 设置可commandName和CommandArgument在Datalist的Command事件里写绑定代码 如何得到网上可用的代理服务器? 套用母版页使用jquery validate验证无效 Cookie与Session 点击treeview节点 不发生跳转 ASP.NET 2.0中的MembershipUser能否扩展?????? CSDN.NET社区 QQ群 分页显示问题 为什么在2003上无法运行javascript程序? WCF 一点小问题 回家了真高兴(散分) asp.net mvc 如何应用model 在aspx文件中,直接写code的问题?
<asp:DataList ID="DataList1" runat="server">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
<div id = "MyDiv" style="display:none"><%#DataBinder.Eval(Container.DataItem,"ID"%></div>
</ItemTemplate>
</asp:DataList>
我是这么实现的,不过这个方法有一点不好,弹出的位置不能固定
点击linkbutton时用windows.open()打开一个没有地址栏,没有状态栏的子窗口. 将ID传过去.在打开的页面上进行详细资料的修改,修改完成,自动返回到上一页面,并关闭。
父页面:点击linkbutton时打开另一页面 window.open(url,'更新','width=720,Height=550,scrollbars=yes,resizable=yes');
子页面修改完成:
Response.Write("<script>alert('修改成功')</script>");
Response.Write("<script>window.opener.location=window.opener.location; window.close();</script>");
下面是让父窗口不可编辑的代码
<html>
<head>
<script>
function locking(){
document.all.ly.style.display="block";
document.all.ly.style.width=document.body.clientWidth;
document.all.ly.style.height=document.body.clientHeight;
document.all.Layer2.style.display='block';
}
function Lock_CheckForm(theForm){
document.all.ly.style.display='none';document.all.Layer2.style.display='none';
return false;
}
</script></head>
<body>
<img src="http://powereasy.net/skin/since07/images/sf_cms_banner1.jpg">
<p align="center">
<input type="button" value="系统锁定" onclick="locking()">
</p>
<div id="ly" style="position: absolute; top: 0px; filter: alpha(opacity=60); background-color: #777;
z-index: 2; left: 0px; display: none;">
</div>
<!-- 浮层框架开始 -->
<div id="Layer2" align="center" style="position: absolute; z-index: 3; left: expression((document.body.offsetWidth-540)/2); top: expression((document.body.offsetHeight-170)/2);
background-color: #fff; display: none;" >
<table width="540" border="0" cellpadding="0" cellspacing="0" style="border: 0 solid #e7e3e7;
border-collapse: collapse">
<tr>
<td style="background-color: #73A2d6; color: #fff; padding-left: 4px; padding-top: 2px;
font-weight: bold; font-size: 14px;" height="27" valign="middle">
[ 警 告 ]
</td>
</tr>
<tr>
<td height="130" align="center">
<input type="button" value=" 确定 " onclick="Lock_CheckForm(this);">
</td>
</tr>
</table>
</div>
<!-- 浮层框架结束 -->
</body>
</html>
在Datalist的Command事件里写绑定代码