iframe配合JQueryUI dialog实现登录对话框效果

先上图:

其实里面的对话框是一个iframe,不把他们做到一个页面中主要方便模块式开发,而且可以带来禁用javascript的时候也能打开编辑界面的效果(当然关闭的时候还需要处理一下):

 

主要代码:把iframe显示为一个模拟对话框:

 $("<iframe id='editFrame' src='EditPersonPage.aspx?action=insert' />").dialog({ autoOpen: true, modal: true, title: "新增人员" });

主界面:

    <script type="text/javascript">
        var insertClick = function(e) {
            $("<iframe id='editFrame' src='EditPersonPage.aspx?action=insert' />").dialog({ autoOpen: true, modal: true, title: "新增人员" });
            e.preventDefault();
        };
        var editClick = function(e) {
            var editUrl = "EditPersonPage.aspx?action=edit&id=" + $(this).attr("rowid");
            $("<iframe id='editFrame'/>").attr("src", editUrl).dialog({ autoOpen: true, modal: true, title: "编辑人员" });
            e.preventDefault();
        };
        $(function() {
            $("#linkInsert").click(insertClick);
            $("a[action=edit]").click(editClick);
        });
        function CloseEditPage() {
            $("#editFrame").dialog("close");
            document.location.reload();
        }
    </script>

CloseEditPage方法是关闭对话框并且刷新,供编辑对话框调用。

编辑界面中在保存关闭以后调用父窗口的方法:window.parent.CloseEditPage()关闭编辑对话框。

protected void FormView1_ItemUpdated(object sender, FormViewUpdatedEventArgs e)
        {
            ClientScript.RegisterStartupScript(GetType(), "close", "window.parent.CloseEditPage();", true);
        }

        protected void FormView1_ItemInserted(object sender, FormViewInsertedEventArgs e)
        {
            ClientScript.RegisterStartupScript(GetType(), "close", "window.parent.CloseEditPage();", true);
        }

这个程序在IE6、IE8、Firefox下都运行通过。

代码下载:http://files.cnblogs.com/rupeng/JQueryDlg.zip

如鹏网.Net培训班正在报名,有网络的地方就可以参加如鹏网的学习,学完就能高薪就业,点击此处了解

 

    三年前只要懂“三层架构”就可以说“精通分层架构”;现在则需要懂IOC(AutoFac等)、CodeFirst、lambda、DTO等才值钱;

    三年前只要会SQLServer就可以说自己“精通数据库开发”;现在则需还需要掌握MySQL等开源数据库才能说是“.Net开源”时代的程序员;

    三年前只要会进行用户上传内容的安全性处理即可;现在则需要熟悉云存储、CDN等才能在云计算时代游刃有余;

    三年前只要掌握Lucene.Net就会说自己“熟悉站内搜索引擎开发”;现在大家都用ElasticSearch了,你还用Lucene.Net就太老土了;

    三年前发邮件还是用SmtpClient;现在做大型网站发邮件必须用云邮件引擎;

    三年前缓存就是Context.Cache;现在则是Redis、Memcached的天下;

    如鹏网再次引领.Net社区技术潮流!点击此处了解如鹏网.Net最新课程

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值