What is the best method to pass variables between pages?
Is it through the Session object with large quantities of data and with the querystring/params with smaller quantities?
Hi smith,
Please have a look at this article.
http://msdn.microsoft.com/msdnmag/issues/03/04/ASPNETUserState/
For a quick reference,
http://msdn.microsoft.com/msdnmag/issues/03/04/ASPNETUserState/default.aspx?fig=true#fig1
HTH.
Yes, that is correct.
and for example when I assign a dataset to a Sessionobject as so:
Session("MyData")=MyDataSet
How can I retreive the data from this in another page? Do I need to create a new dataset object and assign the stored dataset to it, like so:
DataSetInOtherPage = Session("MyData") ?
Peter Smith wrote: and for example when I assign a dataset to a Sessionobject as so: Session("MyData")=MyDataSet
How can I retreive the data from this in another page? Do I need to create a new dataset object and assign the stored dataset to it, like so:
DataSetInOtherPage = Session("MyData") ?
Session stores its values as Objects, which means that it can store anything, as everything derives from Object. This means that you must cast the Session item when assigning it to a local variable. For example:
DataSet DataSetInOtherPage = Session["MyData"] as DataSet; [C#]
Dim DataSetInOtherPage As DataSet = CType(Session("MyData"), DataSet) [VB.NET]
0 comments:
Post a Comment