我在两个页面中用Context.Handler来传递参数,在a页面中使用了如下语句:
admin_userlist au;//引用页面
au = (admin_userlist)Context.Handler;
if (!IsPostBack)
{
……
string cc = au.bb;
}
当从b页面中点击按钮进入a页面时,能正确的实现参数的传递;可是当独立打开a页面时就出错了。简单的说就是单独打开含有:page aa; aa = (page)Context.Handler; 语句的页面就会报错,这是为什么啊?但我又一定需要使用能独立打开的a页面。百思不得其解啊,由于太晚明天还要工作,所以只能先把问题放这儿寻求大家的帮助了。先真诚的感谢各位了!!!附出错提示:
Server Error in '/col_search' Application.
--------------------------------------------------------------------------------Specified cast is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidCastException: Specified cast is not valid.Source Error:
Line 46: // Put user code to initialize the page here
Line 47: admin_userlist au;//引用页面
Line 48: au = (admin_userlist)Context.Handler;
Line 49: if (!IsPostBack)
Line 50: {
Source File: c:\Inetpub\wwwroot\col_search\webadmin\admin_userinsert.aspx.cs Line: 48 Stack Trace:
[InvalidCastException: Specified cast is not valid.]
col_search.admin_userinsert.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\col_search\webadmin\admin_userinsert.aspx.cs:48
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
admin_userlist au;//引用页面
au = (admin_userlist)Context.Handler;
if (!IsPostBack)
{
……
string cc = au.bb;
}
当从b页面中点击按钮进入a页面时,能正确的实现参数的传递;可是当独立打开a页面时就出错了。简单的说就是单独打开含有:page aa; aa = (page)Context.Handler; 语句的页面就会报错,这是为什么啊?但我又一定需要使用能独立打开的a页面。百思不得其解啊,由于太晚明天还要工作,所以只能先把问题放这儿寻求大家的帮助了。先真诚的感谢各位了!!!附出错提示:
Server Error in '/col_search' Application.
--------------------------------------------------------------------------------Specified cast is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidCastException: Specified cast is not valid.Source Error:
Line 46: // Put user code to initialize the page here
Line 47: admin_userlist au;//引用页面
Line 48: au = (admin_userlist)Context.Handler;
Line 49: if (!IsPostBack)
Line 50: {
Source File: c:\Inetpub\wwwroot\col_search\webadmin\admin_userinsert.aspx.cs Line: 48 Stack Trace:
[InvalidCastException: Specified cast is not valid.]
col_search.admin_userinsert.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\col_search\webadmin\admin_userinsert.aspx.cs:48
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
解决方案 »
- 类库中刚添加的类在ui能找到,但是生成不成功
- gridview标题栏的dropdownlist全选的问题!!!急求帮助~~~
- 奇怪我的服务器 任务管理 显示内存占用 不对
- label 怎样不显示小数位
- 还是那个注册问题
- .NET 2005 怎么样接收后台的DataSet对象,用AJAX.NET实现
- 关于更改datagrid更新列宽度的问题
- 当填写一个表单并产生IsPostBack事件时,如何让前面所填写的密码框里面的信息不为空!!!!!
- 对大家来说很简单,这其中的三行代码是做什么用的?
- 在aspx里写了段菜单代码,想打包后,在多个页面中使用,怎么解决?在线等,问题解决即刻给分。
- 请教.NET(C#)如何产生随机不重复的字符串?
- 控件重命名的问题,很奇怪
if (au !=null && !IsPostBack)
{
……
string cc = au.bb;
}