|
-
Jun 13th, 2004, 08:23 AM
#1
Thread Starter
Frenzied Member
ViewState and custom objects?
Does anyone know how to stick an object in ViewState? I mean an object you coded 100%. I get this Serial error and my object is marked as [System.ISerializable] and that should work..? I mean I don't really have time to make a type converter, unless I just make it use ToString.....
Magiaus
If I helped give me some points.
-
Jun 14th, 2004, 09:53 AM
#2
Frenzied Member
I might have the wrong idea here so tell me if I'm barking up the wrong tree.
If you object has various properties then you should be able to load these into the viewstate - you must also provide the facility to get them afterwards.
Example for a property of type int called Top:
Code:
public int Top {
get
{
object obj = ViewState["Top"];
return (obj == null) ? 0 : (int) ViewState["Top"];
}
set
{
ViewState["Top"] = value;
}
}
HTH
DJ
-
Jun 14th, 2004, 07:03 PM
#3
Thread Starter
Frenzied Member
right except i am attempting to put in an object i wrote that has a base class of object
Magiaus
If I helped give me some points.
-
Jun 14th, 2004, 07:07 PM
#4
Thread Starter
Frenzied Member
and the error accuries when i try to intialize the view state property
Magiaus
If I helped give me some points.
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
|