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

为什么关闭模态窗口会刷新父页面.可以不刷新吗
代码大致如下


private   void   Page_Load(object   sender,   System.EventArgs   e)
{
WriteModalTree();
Button2.Attributes.Add   ( "onclick ", "showModal(); ");
}


private   void   WriteModalTree()
{
StringBuilder   sb=new   StringBuilder   ( " ");
sb.Append   ( " <script   language=\ "javascript\ "> \n ");
sb.Append( "function   showModal()\n ");
sb.Append( "{\n ");;
sb.Append( "var   returnValue=window.showModalDialog(\ " "+HttpContext.Current.Request.ApplicationPath+ "/WebForm2.aspx?module=111\ ",\ "\ " ");
sb.Append( ",\ "status:No;scroll:Yes;dialogWidth:750px;dialogHeight:550px;edge:raised;unadorned:Yes;resizable:Yes\ ");\n ");
sb.Append( "if(returnValue!=\ "undefined\ "   &&   returnValue!=undefined)   return   false;\n ");
sb.Append( "}\n ");
sb.Append( " </script> ");
if(!this.Page.IsClientScriptBlockRegistered   ( "showModalScript "))
{
this.Page.RegisterClientScriptBlock   ( "showModalScript ",   sb.ToString   ());
}
}


当点Button2按钮的时候弹出WebForm2.aspx.WebForm2.aspx是一个空的页面,什么也没有.当点右上角关闭此模态窗口就会刷新父页面.为什么?可以不刷新吗

------解决方案--------------------
Button2.Attributes.Add ( "onclick ", "showModal();return false; ");