Microsoft Developer
Microsoft Developer

Reputation: 5459

What does "DataView is not marked as serializable in System.data" mean?

When I store dataview in viewstate,.net shows the error "Dataview is not marked as serializable in system.data but when I store it in session, then it works perfectly? What is the reason behind it?? Which are the other objects that are not marked as "serializable " ?

Upvotes: 4

Views: 4902

Answers (1)

canon
canon

Reputation: 41695

It means that the object you want to store (DataView) isn't marked with a SerializableAttribute.

Now, the reason you're getting this error with ViewState and not with Session is because the ViewState is always serialized but that's not necessarily true of Session. In-Process sessions are stored in the server's memory and require no serialization. SQLServer sessions have to be serialized for storage in a database.

So, anytime you want to store an object in the ViewState (or a serialized Session), it must be marked with a SerializableAttribute.

Upvotes: 7

Related Questions