按服务端button按钮客户端弹出一个新页怎么实现(不想用输出客户端脚本的方法) 如题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 最终实现是要用JSCRIPT的,不过可以对JSCRIPT封装成一个服务器方法,在服务器端调用public void OpenWindow(IAttributeAccessor control,string pageName,int height,int width,bool status,bool toolbar,bool menubar,bool location) { string s="no",t="no",m="no",l="no"; if(status) s="yes"; if(menubar) m="yes"; if(toolbar) t ="yes"; if(location) l = "yes"; string strScript = string.Format(JavaScriptString.WINDOW_OPEN,pageName,height,width,s,t,m,l); control.SetAttribute("onclick",strScript+"return false;"); }/// <summary> /// 打开窗 /// 参数[页面名称,窗体高度,窗体宽度,状态栏(yes/no),工具栏(yes/no),菜单栏(yes/no),位置栏(yes/no)] /// </summary> public const string WINDOW_OPEN ="window.open('{0}',null,'height={1},width={2},status={3},toolbar={4},menubar={5},location={6}')"; 关注一下。。难道你还想用服务器程序让客户端弹出IE窗口??这个不行的。必须输出脚本到IE,让客户端的IE自己打开另一个IE窗口。 buttonname.Attributes.Add("onclick","javascript:window.open('');"); 要是服务器脚本弹出窗口了,那窗口也是在服务器上啊,客户端怎么能看到呢? ryg221() 的答案是正确的。 无论怎么做,最终都是要通过输出script代码到客户端IE来实现。 this.RegisterClientScriptBlock("Openwindow","<script language=\"javascript\">window.open('');</script>"); 只能用script弹,不过最好还是避免弹出吧,现在好多插件阿浏览器阿都是禁止弹出窗口的 我用this.RegisterClientScriptBlock("Openwindow","<script language=\"javascript\">window.open('');</script>");这种方法。是弹出新窗口。可是它并不在最前面 this.btnSelectPresider.Attributes.Add("onclick","window.showModalDialog('MeetingParticipatePerson.aspx');"); this.btnSelectPresider.Attributes.Add("onclick","window.showModalDialog('MeetingParticipatePerson.aspx');");是弹出在最前面的新窗口。可是它是不全的小窗口。我要ie大窗口 asp.net实现给网站充值,直接从手机扣费或者用手机充值卡充值 分享电子书 动态TABLE添加CheckBoxList问题(高分求,要线等) 在已绑定ilist的DropDownList中插入一个实体对象 求救! 如何定义DataGrid风格? 请教,网站所有上传全部放到同一个文件夹,有什么隐患,一般怎么处理上传文件夹比较好 怎么让excel文件不直接在ie里面打开? 新手第2问,(关于简单的存储过程,实现通过WEB页生成SQL SERVER表。) 急!!如何控制打印属性? response.redirect("123.xls")如何能在新的IE窗口打开??????? ? 关于消息框
public void OpenWindow(IAttributeAccessor control,string pageName,int height,int width,bool status,bool toolbar,bool menubar,bool location)
{
string s="no",t="no",m="no",l="no";
if(status)
s="yes";
if(menubar)
m="yes";
if(toolbar)
t ="yes";
if(location)
l = "yes";
string strScript = string.Format(JavaScriptString.WINDOW_OPEN,pageName,height,width,s,t,m,l);
control.SetAttribute("onclick",strScript+"return false;");
}
/// <summary>
/// 打开窗
/// 参数[页面名称,窗体高度,窗体宽度,状态栏(yes/no),工具栏(yes/no),菜单栏(yes/no),位置栏(yes/no)]
/// </summary>
public const string WINDOW_OPEN ="window.open('{0}',null,'height={1},width={2},status={3},toolbar={4},menubar={5},location={6}')";
ie大窗口