Sessin in DataGrid's Inherted Class

M

Marcin Gorzynski

Hi
I am trying to develope custom grid gving pssibility to save its datasource
to XML file, View State and Session
Problem is with Session because when I do drag and drop this control into
vsiual designer I see error that makes my control not visualize properly.
"Error rendering the control. Make sure all properites are valid"

get
{
object o = Page.Session["_currentsource"];

if (o == null)

{

return new Exception("Source not provided");

}

return (object)Page.Session["_currentsource"];

}

Any idea how I can use sessin inside inherited class?

Best Regards
Marcin Gorzynski
 
A

A Traveler

Session is only valid when you are actually in a running instance of your
application.
You can use the session fine, you only need to make sure to only use it when
you are in a session.
To check this, do something as follows:

If Not Me.Context Is Nothing Then
SaveMyData()
Else
'// Whatever you want to do when you are in design mode.
End

Hope this helps.
CheerZ.
 

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
473,780
Messages
2,569,608
Members
45,244
Latest member
cryptotaxsoftware12

Latest Threads

Top