【发布时间】:2012-07-09 08:52:20
【问题描述】:
我的 asp 页面上有一个转发器,我想将该转发器与后面的代码绑定(C#)。在 c# 页面上,我有一个静态方法来绑定转发器。但是我收到错误
“对象未设置为对象的实例”
我拥有的静态方法是..
[WebMethod(EnableSession = true)]
public static void LoadData()
{
Default oDefault = new Default();
Page p = new Page();
if ((List<AllPostInformation>)p.Session["AllNewsPostCollection"] != (List<AllPostInformation>)p.Session["CheckExistData"])
{
if ((List<AllPostInformation>)p.Session["AllNewsPostCollection"] != null)
{
List<AllPostInformation> o = new List<AllPostInformation>();
o = (List<AllPostInformation>)p.Session["AllNewsPostCollection"];
oDefault.rptNews.DataSource = o;
oDefault.rptNews.DataBind();
}
p.Session["CheckExistData"] = p.Session["AllNewsPostCollection"];
}
}
Please Help???
【问题讨论】:
-
p.Session["AllNewsPostCollection"];没有返回任何东西...
-
我已经在我们的代码中早些时候启动了这个会话,当我调试时我发现 Session["AllNewsPostCollection"] 有所需的数据。