Public object GridData
{
get
{
return DataGrid1.DataSource;
}
}
和
if(!Page.IsPostBack)
{
objSendingPage = ( SendingPage)context.Handler;
}
{
get
{
return DataGrid1.DataSource;
}
}
和
if(!Page.IsPostBack)
{
objSendingPage = ( SendingPage)context.Handler;
}
{
objSendingPage = ( SendingPage)context.Handler;
}
和
Dim objSendingPage As SendingPage
Sub Page_Load()
If Not IsPostBack Then
objSendingPage = CType(context.Handler, SendingPage)
End If
两段代码是一个意思吗?编译后又出错啦!
指定的转换无效。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.InvalidCastException: 指定的转换无效。源错误:
行 25: if (!Page.IsPostBack)
行 26: {
行 27: objSendingPage=( WebForm1) Context.Handler;
行 28: }
行 29: DataGrid1.DataSource=objSendingPage.GridData;
源文件: c:\inetpub\wwwroot\webapplication7\webform2.aspx.cs 行: 27 堆栈跟踪:
[InvalidCastException: 指定的转换无效。]
WebApplication7.WebForm2.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\webapplication7\webform2.aspx.cs:27
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
版本信息: Microsoft .NET 框架版本:1.0.3705.0; ASP.NET 版本:1.0.3705