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

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

+4
source share
1 answer

This means that the object you want to save ( DataView ) is not marked SerializableAttribute .

Now, the reason you get this error with ViewState, and not with Session, is because the ViewState is always serialized, but this is not necessarily true for Session. In-process sessions are stored in server memory and do not require serialization. SQLServer sessions must be serialized for storage in the database.

So, anytime you want to save an object in a ViewState (or serialized session), it should be marked SerializableAttribute .

+6
source

All Articles