This is a migrated thread and some comments may be shown as answers.
RadScheduler serialization
5 Answers 65 Views
This is a migrated thread and some comments may be shown as answers.
Marek Witczak
Top achievements
Rank 1
Marek Witczak asked on 28 Oct 2009, 09:08 AM
Hello,
I'm experiencing a problem when trying to save/load RadScheduler control to/from Viewstate.
There is an error:


[SerializationException: Type 'Telerik.Web.UI.RadScheduler' in 'Telerik.Web.UI, Version=2009.2.701.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4' not marked as serializable.]
   System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) +7733643
   System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) +258
   System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() +111
   System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) +161
   System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) +51
   System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +410
   System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +134
   System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph) +13
   System.Web.UI.ObjectStateFormatter.SerializeValue(SerializerBinaryWriter writer, Object value) +845

[ArgumentException: Error serializing 'Telerik.Web.UI.RadScheduler'.]
   System.Web.UI.ObjectStateFormatter.SerializeValue(SerializerBinaryWriter writer, Object value) +3395
   System.Web.UI.ObjectStateFormatter.Serialize(Stream outputStream, Object stateGraph) +110
   System.Web.UI.ObjectStateFormatter.Serialize(Object stateGraph) +57
   System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Serialize(Object state) +4
   System.Web.UI.Util.SerializeWithAssert(IStateFormatter formatter, Object stateGraph) +37
   System.Web.UI.HiddenFieldPageStatePersister.Save() +79
   System.Web.UI.Page.SavePageStateToPersistenceMedium(Object state) +105
   System.Web.UI.Page.SaveAllState() +236
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1099


Any ideas would be appreciated

Marek Witczak

5 Answers, 1 is accepted

Sort by
0
Accepted
T. Tsonev
Telerik team
answered on 30 Oct 2009, 09:48 AM
Hi,

If I understand correctly, you're trying to store the RadScheduler control itself in the ViewState. Storing controls in the ViewState is not supported in general. They're not serializable by default and even if they were re-using them between requests will lead to many problems, as they won't be participating correctly in the page life-cycle.

Same goes for storing controls in SessionState and Cache. Doing so leads to even more serious issues like memory leaks on the server.

Can you give us more details on why you need to store the control in the ViewState?

Perhaps you can store the data in the ViewState, if you don't want RadScheduler to do that for you. We have an example that demonstrates this (but with the Session):

http://demos.telerik.com/aspnet-ajax/scheduler/examples/bindtolist/defaultcs.aspx

Regards,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Marek Witczak
Top achievements
Rank 1
answered on 30 Oct 2009, 10:25 AM
Hello,
Thanks for your reply.
Well, my problem is that my RadScheduler is quite expensive to create. I tried the Session approach, but as you just said, it gives more serious problems than just slowing down.
I've done actually exactly the same thing you suggested - store in ViewState everything but control itself, and it gives me much better performance.

Cheers
Marek Witczak
0
Joseph
Top achievements
Rank 1
answered on 16 Nov 2009, 10:14 AM
Any idea how to Serialize the data in the Scheduler into a file?

I want a automatic save/load mechanism to save changes and load them back again.

Thanks.
0
T. Tsonev
Telerik team
answered on 18 Nov 2009, 05:16 PM
Hi Joseph,

You can store the appointments in a file using the XmlScheduler provider. Take a look at this demo:
http://demos.telerik.com/aspnet-ajax/scheduler/examples/xmlschedulerprovider/defaultcs.aspx

More info on providers here:
http://www.telerik.com/help/aspnet-ajax/schedule_databindingusingadataprovider.html

Sincerely yours,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
thaya
Top achievements
Rank 1
answered on 20 Oct 2011, 12:03 PM
hi.........


Type 'Telerik.WebControls.GridDataItem' in Assembly 'RadGrid.Net2, Version=4.6.2.0, Culture=neutral, PublicKeyToken=ec87bc2939ec45df' is not marked as serializable.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.Serialization.SerializationException: Type 'Telerik.WebControls.GridDataItem' in Assembly 'RadGrid.Net2, Version=4.6.2.0, Culture=neutral, PublicKeyToken=ec87bc2939ec45df' is not marked as serializable.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SerializationException: Type 'Telerik.WebControls.GridDataItem' in Assembly 'RadGrid.Net2, Version=4.6.2.0, Culture=neutral, PublicKeyToken=ec87bc2939ec45df' is not marked as serializable.]
   System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) +9444601
   System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) +247
   System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() +160
   System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) +218
   System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) +54
   System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +542
   System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +133
   System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph) +13
   System.Web.UI.ObjectStateFormatter.SerializeValue(SerializerBinaryWriter writer, Object value) +3056

[ArgumentException: Error serializing value 'Telerik.WebControls.GridDataItem' of type 'Telerik.WebControls.GridDataItem.']
   System.Web.UI.ObjectStateFormatter.SerializeValue(SerializerBinaryWriter writer, Object value) +3371
   System.Web.UI.ObjectStateFormatter.Serialize(Stream outputStream, Object stateGraph) +141
   System.Web.UI.ObjectStateFormatter.Serialize(Object stateGraph) +57
   System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Serialize(Object state) +4
   System.Web.UI.Util.SerializeWithAssert(IStateFormatter formatter, Object stateGraph) +37
   System.Web.UI.HiddenFieldPageStatePersister.Save() +79
   System.Web.UI.Page.SavePageStateToPersistenceMedium(Object state) +108
   System.Web.UI.Page.SaveAllState() +315
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2839

am not familiar in telerik am starter to telerik in my application all controls are created dynamically
i'v stuck in this for two days........

also pls give sample for displaying a image in radgrid , in my solution an image column is plased in grid but the exact image is not displayed what i'v to do............
am waiting for ur reply..........
thanks in advance.........

Asked by
Marek Witczak
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Marek Witczak
Top achievements
Rank 1
Joseph
Top achievements
Rank 1
thaya
Top achievements
Rank 1
Share this question
or