asp.net和showModalDialog的问题(急)
参照csdn中的一篇文章(CSDN技术中心 Asp_net页面之间通过脚本传递数据)中实现如下:
Admin_News_Edit.aspx
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if (!IsClientScriptBlockRegistered("clientScript"))
{
string strScript;
strScript="<script language=javascript>" + "\n";
strScript += "function OpenWin()\n{";
strScript += "var str=window.showModalDialog('WebForm2.aspx',document.Form1.RelatedNewsID.value,'dialogWidth:50px;dialogHeight:50px;help:no;scroll:no;status:no');\n";
strScript += "if(str!=null) document.Form1.RelatedNewsID.value=str;\n";
strScript += "}\n";
strScript += "</script>\n";
RegisterClientScriptBlock("clientScript", strScript);
}
Button1.Attributes.Add("onclick","OpenWin()");
//这下面为打开新闻页面时提取内容至控件
if(!Page.IsPostBack)
{
getNewsType(this.dropNewsType);
getArticle();
}
点击button1页面提交到自身,并没有弹出模式对话框。
查看网页源文件,该按钮注册的客户端函数如下:
<input type="submit" name="Button1" value="side" onclick="OpenWin()if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); " language="javascript" id="Button1" />,不知道这样对不对。
请各位教我。
相关推荐
ASP.NET模态窗口的实现
介绍showModalDialog和showModelessDialog实现模态窗口的使用心得
showModalDialog 和 showModelessDialog
关于showModalDialog和showModelessDialog的使用,一个b/s结构的项目中用window.open弹出的窗口被一些广告拦截工具给拦截了,没办法就只能用showModalDialog来解决问题,但showModalDialog这个方法不好的就是页面间传值太麻烦(传值有两种方法),可是实在没其他的办法来解决这个拦截问题,只有用这个了。代码到是两下就写好了,但调试代码的时候发现一个问题,用showModalDialog弹出的窗口中的内容一直是第一次访问页面时显示的内容,开始就怀疑是窗体调用的页面缓存,最后通过单步跟踪调试也证明了问题确实是读取的页面缓存,这说明了在asp.
asp.net弹出窗口 返回值
Page.aspx: 代码如下:<html xmlns=”http://www.w3.org/1999/xhtml”><head runat=”server”><title>无标题页</title>[removed]…function Pop() …{ var result=showModalDialog(‘downs.aspx’,’subpage’,’dialogWidth:400px;dialogHeight:300px;center:yes;help:no;resizable:no;status:no’); //打开模态子窗体,并获取返回值d
asp.net中打开新窗口的多种方法
1.Response.Redirect("XXX.aspx",true)——直接转向新的页面,原窗口被代替; 2. Response.Write("<script>window.open(XXX.aspx','_blank')</script>")——原窗口保留,另外新增一个新页面;
window.showModalDialog两次加载问题清除缓存方法
window.showModalDialog两次加载问题:你第一次打开窗口后,第二次浏览器没有从服务器端取数据,而直接找到了你已经下载的文件


