|
-
Feb 26th, 2003, 11:56 PM
#1
Thread Starter
Lively Member
Can I store an Object in ViewState?
Sorry another newbie post here...
Is it possible to store an Object against a page between form Posts?
ViewState will only take a string .. are there any other .. ways of storing the object or do I need a typeconverter of some sort?
-
Feb 27th, 2003, 10:22 AM
#2
Absolutely!
All you have to do is to cast the object back when you need it:
Code:
ViewState["yourObject"] = yourObject;
...to read
YourObjectType yourObject = (YourObjectType)ViewState["yourObject"];
-
Feb 27th, 2003, 05:32 PM
#3
Thread Starter
Lively Member
Thanks Serge!
Just for the record, the typecasting in VBScript is:
Code:
myObject = DirectCast(viewstate("myObject"), myObjectType)
Unfortunately the object I'm handling is not Serializable - I think that is my next job ...
Cheers,
Tim
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|