读书人

jqModal打开链接后在链接的页面里封

发布时间: 2012-10-08 19:54:56 作者: rapoo

jqModal打开链接后,在链接的页面里关闭这个jqModal方法
jqModal打开链接后,在链接的页面里关闭这个jqModal的方法

protected void btnClose_Click(object sender, EventArgs e){try        {            string scr = string.Format(@"<script>window.parent.theForm.jqmClose.click()</script>");            string csname1 = "SelOrderDetail";            Type cstype = this.GetType();            // Get a ClientScriptManager reference from the Page class.            ClientScriptManager cs = Page.ClientScript;            // Check to see if the startup script is already registered.            if (!cs.IsStartupScriptRegistered(cstype, csname1))            {                cs.RegisterStartupScript(cstype, csname1, scr);            }        }        catch (BizException bizEx)        {            WebUtil.ShowMsg(this.Page, bizEx.Message);        }        catch (Exception ex)        {            WebUtil.ShowMsg(this.Page, ex.Message);            Logger.Write(ex);        }}

重点是这句:
<script>window.parent.theForm.jqmClose.click()</script>
    window.parent. 在当前页面获得父页面; theForm. 在父页面里获得Form表单; jqmClose. 在Form表单里获得jqModal的关闭按钮jqmClose(这里的jqmClose是关闭按钮的id,不是class名); click() 模拟获得的关闭按钮的单击事件

这样就ok啦!

读书人网 >Web前端

热点推荐