Can I use "Session" inside a user control ?

C

craigkenisston

I'm creating a paging control in which I want to use a session saved
dataview :

public class PagingControl : System.Web.UI.UserControl
....
....

public void whatever
DataView dw;
if (Session["Results"] != null)
{
dw = (DataView)Session["Results"];
}
else
{
return;
}


At the point of the "if" statement I get a null object reference error.
So, may be I'm trying to do something not allowed ...
Any idea ?
 
B

Brock Allen

Perhaps you're doing this too early in the control's lifetime, like in the
constructor?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top