模式窗体来模拟的MessageBox

模式窗体来模拟的MessageBox   
    
    
  //使用方法:建一个基页面,将下列函数复制过去,其它所有页面从基页面继承,在派生页面中按钮事件中就可以调用下面的函数  
None.gif    // 在弹出窗口的aspx中<head></head>间加入以下代码:<base   target="_self">   
None.gif    
None.gif  
// 弹出一个模式窗口   
None.gif  
// url:弹出窗体地址   
None.gif  
// width:弹出窗体宽度   
None.gif  
// height:弹出窗本高度   
None.gif  
// allowStatus:是否显示状态条   
None.gif  
// allowScroll:是否显示滚动条   
None.gif  
// refreshParent:返回时是否刷新父窗体   
None.gif  
// refreshButtonID:保留不用,即为空字符串   
None.gif
    
None.gif  
public     void    CspOpenWindowModal   ( string    url,    int    width,    int    height, string    allowStatus, string    allowScroll, bool    refreshParent, string    refreshButtonID)   
ExpandedBlockStart.gifContractedBlock.gif  
dot.gif {   
InBlock.gif  
string   options="'dialogWidth="+width+"px;dialogHeight   ="+height+"px;"+   
InBlock.gif  
"help=no;status="+allowStatus+";scroll="+allowScroll+"'";   
InBlock.gif  
if(refreshParent==true)   
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif{   
InBlock.gif  GetPostDoPostBackScript();   
ExpandedSubBlockEnd.gif  }
   
InBlock.gif  RegisterStartupScript(Guid.NewGuid().ToString(),   
"<script   language=\"JavaScript\">"   +   GetPopupScriptModal(url,   options,   refreshParent,refreshButtonID)   +   "</script>");   
ExpandedBlockEnd.gif  }
   
None.gif    
None.gif  
protected     string    GetPopupScriptModal( string    url,    string    options, bool    refreshParent, string    refreshButtonID)   
ExpandedBlockStart.gifContractedBlock.gif  
dot.gif {   
InBlock.gif  
string   returnScript;   
InBlock.gif  
if(refreshParent==true)   
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif{   
InBlock.gif  returnScript
="var   w=window.showModalDialog(\""   +   url   +   "\",   '',   "   +   options   +   ");__doPostBack('"+refreshButtonID+"','');";   
ExpandedSubBlockEnd.gif  }
   
InBlock.gif  
else   
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif{   
InBlock.gif  returnScript
="var   w=window.showModalDialog(\""   +   url   +   "\",   '',   "   +   options   +   ");";   
ExpandedSubBlockEnd.gif  }
   
InBlock.gif  
return   returnScript;   
ExpandedBlockEnd.gif  }
   
None.gif    
ExpandedBlockStart.gifContractedBlock.gif  
/**/ /************************************关闭窗体************************/    
None.gif  
// 关闭一个窗口   
None.gif  
// refreshParent:是否刷新父窗体,对模式窗体无效,只能是false   
None.gif
   public     void    CspCloseWindow   ( bool    refreshParent)   
ExpandedBlockStart.gifContractedBlock.gif  
dot.gif {   
InBlock.gif  RegisterClientScriptBlock(Guid.NewGuid().ToString(),   
"<script   language=\"JavaScript\">"   +   GetCloseWindowScript(refreshParent)   +   "</script>");   
ExpandedBlockEnd.gif  }
   
None.gif    
None.gif  
protected     string    GetCloseWindowScript( bool    refreshParent)   
ExpandedBlockStart.gifContractedBlock.gif  
dot.gif {   
InBlock.gif  
string   script="";   
InBlock.gif  
if   (refreshParent)   
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif{   
InBlock.gif  script   
=   "window.opener.document.forms(0).submit();";   
ExpandedSubBlockEnd.gif  }
   
InBlock.gif    
InBlock.gif  
return   script+"window.close();";   
ExpandedBlockEnd.gif  }
  




来源:互联网
http://netread.caotingna.com/item/gelu-gaoshou-jinlai-taolun-you__90652.aspx
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值