日期:2014-05-18  浏览次数:20594 次

asp.net弹出一个层对话框


如上图所示,我想实现:点击复制 模板列(ItemTemplate)时,弹出一个 div层对话框,

在这个对话框里,得到当前行的id值,然后根据此id值,在数据库中插入一条新的记录。

请教 这个功能如何实现,用jquery或其它的js弹出对话框都行。

谢谢。


------解决方案--------------------
使用window.open或者window.showdilog...不一定非要用层摄- -
非要用的话 Jquary插件也很多的
------解决方案--------------------
window.open已经足够满足你了
------解决方案--------------------
ClientScript.RegisterStartupScript(this.GetType(), "aa", "<script>window.showModalDialog('页面地址?id=3','dialogWidth:400px;dialogHeight:400px')</script>");
大概就这样


 
 
 
 
----------------------------------签----------名----------栏----------------------------------
------解决方案--------------------
HTML code


遮罩层样式
.black_overlay
{
    display: none;
    position: absolute;
    top: 0%;
    left: 0%;
    width: 100%;
    height: 100%;
    background-color:Gray;
    z-index: 1001;
    -moz-opacity: 0.6;
    opacity: .80;
    filter: alpha(opacity=50);
}

 <script language="javascript" type="text/javascript">
        function ShowDiv() {
            G('showDiv').style.display = 'block';
            G('fade').style.display = 'block';
            G('fade').style.height = Math.max(document.documentElement.scrollHeight, document.documentElement.clientHeight) + 'px';
        }
        function CloseDiv() {
            G('showDiv').style.display = 'none';
            G('fade').style.display = 'none'
        }
        function CheckForm() {
            if (G("txtDepName").value.replace(/\s/g, "") == "") {
                alert("名称不能为空!");
                G("txtDepName").focus();
                return false;
            }
            return true;
        }
    </script>


+++++++++++++++++++++++++++++++

<a href="javascript:ShowDiv();"><img src="../images/add.gif" border="0" />添加部门</a>
遮罩层
<div id="fade" class="black_overlay"></div>
弹出层
<div id="showDiv" style="width: 500px; display:none">
        <table width="500px" cellpadding="0" cellspacing="0">
            <tr>
                <td colspan="4">
                    <p class="title2">
                        <span>部门信息</span><img src="../images/close.jpg" onclick="CloseDiv();" alt="关闭" width="14"
                            height="14" /></p>
                </td>
            </tr>
            <tr>
                <td align="right">
                    <font color='red'>*</font>名称:
                </td>
                <td align="left">
                    <asp:TextBox runat="server" ID="txtDepName"></asp:TextBox>
                </td>
                <td align="right">
                    上级单位
                </td>
                <td align="left">
                    <asp:DropDownList runat="server" ID="dlDep" DataTextField="DepName" DataValueField="DepID">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td align="right">
                    简称:
                </td>
                <td align="left">
                    <asp:TextBox runat="server" ID="txtJC"></asp:TextBox>
                </td>
                <td align="right">
                    排序号: