- C# code
错误 10 未能找到类型或命名空间名称“Page”(是否缺少 using 指令或程序集引用?) D:\新建文件夹\repeater+page+存储过程分页\repeater+aspnetpage+存储过程范例\repeaterDAO\OpenWindow.cs 59 42 repeaterDAO下面我贴出代码了,请高手给我举个完整的例子,好吧
------解决方案--------------------------------------------------------
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
page 是调用此方法
的当前页面,代码没有错误,只是没用引用空间!!!!!
- C# code
public static void OpenNewWinodw(Page page, string URL, string PageName, string Win_Width, string Win_Hight, string Left, string Top, string CenterFlag, string Status, bool ParentFlag){ string scriptstr = ""; if (ParentFlag) { scriptstr = "<script language=javascript>showModalDialog('" + URL + "','" + PageName + "','dialogWidth:" + Win_Width + "px;" + "dialogHeight:" + Win_Hight + "px;dialogLeft:" + Left + "px;dialogTop:" + Top + "px;center:" + CenterFlag.ToString() + ";help:no;resizeable:yes;status:" + Status + "')</script>"; } else { scriptstr = "<script language=javascript>showModelessDialog('" + URL + "','" + PageName + "','dialogWidth:" + Win_Width + "px;" + "dialogHeight:" + Win_Hight + "px;dialogLeft:" + Left + "px;dialogTop:" + Top + "px;center:" + CenterFlag.ToString() + ";help:no;resizeable:yes;status:" + Status + "')</script>"; } page.Response.Write(scriptstr); }
------解决方案--------------------------------------------------------
- C# code
protected void Page_Load(object sender, EventArgs e) { OpenNewWinodw(this, "http://www.baidu.com", "页面名称", "500", "300", "100", "50", "yes", "yes", true); } /// 打开一个窗口,并且这个窗口位于最前面 /// </summary> /// <param name="page">提用的页面</param> /// <param name="URL">要打开的URL</param> /// <param name="PageName">要打开页面的名称</param> /// <param name="Win_Width">窗口宽度</param> /// <param name="Win_Hight">窗口高度</param> /// <param name="Left">窗口左侧位置</param> /// <param name="Top">窗口右侧位置</param> /// <param name="CenterFlag">是否右中 yes/no</param> /// <param name="Status">是否显示状态栏 yes/no</param> /// <param name="ParentFlag">true:不关闭弹出窗口,将不能操作父窗口 false 可以操作父窗口</param> public static void OpenNewWinodw(Page page, string URL, string PageName, string Win_Width, string Win_Hight, string Left, string Top, string CenterFlag, string Status, bool ParentFlag) { string scriptstr = ""; if (ParentFlag) { scriptstr = "<script language=javascript>showModalDialog('" + URL + "','" + PageName + "','dialogWidth:" + Win_Width + "px;" + "dialogHeight:" + Win_Hight + "px;dialogLeft:" + Left + "px;dialogTop:" + Top + "px;center:" + CenterFlag.ToString() + ";help:no;resizeable:yes;status:" + Status + "')</script>"; } else { scriptstr = "<script language=javascript>showModelessDialog('" + URL + "','" + PageName + "','dialogWidth:" + Win_Width + "px;" + "dialogHeight:" + Win_Hight + "px;dialogLeft:" + Left + "px;dialogTop:" + Top + "px;center:" + CenterFlag.ToString() + ";help:no;resizeable:yes;status:" + Status + "')</script>"; } page.Response.Write(scriptstr); }