Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Can I use "Session" inside a user control ?

Reply
Thread Tools

Can I use "Session" inside a user control ?

 
 
craigkenisston@hotmail.com
Guest
Posts: n/a
 
      06-12-2005

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 ?

 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      06-12-2005
Perhaps you're doing this too early in the control's lifetime, like in the
constructor?

-Brock
DevelopMentor
http://staff.develop.com/ballen



> 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 ?




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing USER CONTROL which is inside Masterpagethrough Another USER Control inside normal page. Kiran More ASP .Net Web Controls 2 11-14-2006 12:58 PM
How can I use Wizard Control Inside of FormView Control? John R. Lewis ASP .Net 0 01-04-2006 11:39 PM
Custom User Control is not rendered inside another user control in a server table. Leeor Chernov ASP .Net 2 10-16-2005 08:35 AM
child controls inside a user control inside a datalist Roman ASP .Net Web Controls 2 01-04-2005 07:07 AM
Event not firing for user control inside user control vatech1993 ASP .Net 4 12-11-2004 02:51 PM



Advertisments