RadScheduler serialization

6 posts, 1 answers
  1. Marek Witczak
    Marek Witczak avatar
    10 posts
    Member since:
    Oct 2009

    Posted 28 Oct 2009 Link to this post

    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
  2. Answer
    T. Tsonev
    Admin
    T. Tsonev avatar
    2831 posts

    Posted 30 Oct 2009 Link to this post

    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.
  3. Marek Witczak
    Marek Witczak avatar
    10 posts
    Member since:
    Oct 2009

    Posted 30 Oct 2009 Link to this post

    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
  4. Joseph
    Joseph avatar
    135 posts
    Member since:
    Sep 2007

    Posted 16 Nov 2009 Link to this post

    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.
  5. T. Tsonev
    Admin
    T. Tsonev avatar
    2831 posts

    Posted 18 Nov 2009 Link to this post

    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.
  6. thaya
    thaya avatar
    3 posts
    Member since:
    Sep 2011

    Posted 20 Oct 2011 Link to this post

    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.........

Back to Top