Groups | Blog | Home
all groups > asp.net datagrid control > september 2004 >

asp.net datagrid control : Sessin in DataGrid's Inherted Class


Marcin Gorzynski
9/30/2004 8:30:12 AM
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 Traveler
10/4/2004 10:36:32 AM
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.


[quoted text, click to view]

AddThis Social Bookmark Button