C
Colin Basterfield
Hi,
I am confused...
I have the following code in my Page_Load method
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if (!IsPostBack)
{
SiteSummary siteSummary = new SiteSummary();
RevenueList revList = siteSummary.GetRevenueList();
Session["RevenueList"] = revList;
BindGrid();
}
}
Now my understanding is that I could , and have been loading the Revenue
list directly into the Session object, and then in the BindGrid() method I
assign the collection to the datalist datasource thus:
private void BindGrid()
{
dlRevenueItems.DataSource = (RevenueList)Session["RevenueList"];
dlRevenueItems.DataBind();
}
Now this was working yesterday, but now all of a sudden, when I run it the
assignment to the datasource fails, saying that it isn't set to the instance
of an object.
I am wholly confused when something works intermittently when there has been
no code change.
I can't declare the list private to the overall page class as it falls out
of scope the minute the BindGrid is called, hence the change to the Session
object.
Confused, probably out of ignorance
TIA
Colin B
I am confused...
I have the following code in my Page_Load method
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if (!IsPostBack)
{
SiteSummary siteSummary = new SiteSummary();
RevenueList revList = siteSummary.GetRevenueList();
Session["RevenueList"] = revList;
BindGrid();
}
}
Now my understanding is that I could , and have been loading the Revenue
list directly into the Session object, and then in the BindGrid() method I
assign the collection to the datalist datasource thus:
private void BindGrid()
{
dlRevenueItems.DataSource = (RevenueList)Session["RevenueList"];
dlRevenueItems.DataBind();
}
Now this was working yesterday, but now all of a sudden, when I run it the
assignment to the datasource fails, saying that it isn't set to the instance
of an object.
I am wholly confused when something works intermittently when there has been
no code change.
I can't declare the list private to the overall page class as it falls out
of scope the minute the BindGrid is called, hence the change to the Session
object.
Confused, probably out of ignorance
TIA
Colin B