yufeng217 发表于 2013-1-26 14:38:06

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啦!
页: [1]
查看完整版本: jqModal打开链接后,在链接的页面里关闭这个jqModal方法