保存后刷新父页面

1.后台代码:

 protected void SaveOrUpdateUser(object sender, EventArgs e)

        {

            //从Form表单获取值

            UserInfo user = this.SmartFormView1.ToEntity<UserInfo>();

 

            this._userServie.SaveOrUpdateUser(user);

 

            ScriptHelper.CloseDialog(this, "true");

        }

父页面:

 <web:Script ID="Script1" src="~/Scripts/jquery.utils.js" runat="server" />

<script type="text/javascript">

        function openForm(_this, action) {

            var url;

            // FormViewMode : Insert/Edit/ReadOnly

            var params = { FormViewMode: action }

            if (action == "Insert") {

                url = "/Modules/PublicInfo/WorkingPlanEdit.aspx";

                params.title = "新增工作计划";

            } else if (action == "Edit") {

                url = "/Modules/PublicInfo/WorkingPlanEdit.aspx";

                params.title = "编辑工作计划";

                params.ID = _this.attributes["_ID"].value;

            }

            /*打开Dialog*/

            $.open(buildUrl(url, params), 800, 650, { iframe: true }, function () {

                //执行回调刷新页面

                var args = jQuery.dialogReturnValue();

                if (args) {

                    // e 可以用来判断点击的是关闭还是确定,该值是由 确定和关闭按钮传进来的参数

                    ListRefresh();

                }

            });

            return false;

        }

        function ListRefresh() {

            $("#btnRefresh").click();

        }

    </script>

2.

 <script type="text/javascript">

        var BizID = '<%=Request.Params["BizID"] %>';

        var SysID = '<%=Request.Params["SysID"] %>';

 

        function openEditor(_this, action) {

            var url = "/Modules/PublicInfo/LawsRegulEdit.aspx";

 

            // FormViewMode : Insert/Edit/ReadOnly

            var params = { FormViewMode: action };

 

            if (action == "Insert") {

                params.title = "政策法规新增";

                params.BizID = BizID;

                params.SysID = SysID;

            } else if (action == "Edit") {

                params.title = "政策法规编辑";

                params.ID = _this.attributes["_ID"].value;

            }

            var returnValue = ShowTopDialogPopup(buildUrl(url, params), params.title, 710, 500, function () { ListRefresh(); });

            return false;

        }

        function ListRefresh() {

            $("#btnRefresh").click();

        };

      

    </script>

 

  <web:Script ID="Script10" src="~/Scripts/DialogPopup/DialogPopup.js" runat="server" />

<<DialogPopup.js>>

 <!-- 页脚区域 -->

    <div class="footer">

        <asp:Button ID="Button1" runat="server" Text="确定" OnClientClick="return validateForm();"

            OnClick="SaveOrUpdateLawsRegul" />

        <asp:Button ID="CloseButton2" runat="server" Text="关闭" OnClientClick="return closeBoxyForm(false);" />

    </div>

后台代码:

        protected void SaveOrUpdateLawsRegul(object sender, EventArgs e)

        {         

            Info_PolicyRegulation LawsRegul = SmartForm.GetEntity<Info_PolicyRegulation>(container);      

            bll.SaveOrUpdate(LawsRegul);

            ScriptManager.RegisterStartupScript(this, this.GetType(), "closeBoxyForm", "closeBoxyForm(true); ", true);

        }

posted @ 2013-11-26 23:08  weifb  阅读(402)  评论(0)    收藏  举报