datasource and state server

5 posts, 0 answers
  1. Ibrahim Imam
    Ibrahim Imam avatar
    69 posts
    Member since:
    Jul 2007

    Posted 20 Jan 2009 Link to this post

    hello


    i am getting an error in my report-viewer page because the objects used for datasource use IList which does not implement ISerializable.

    Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.


    i am using state server for sessionStates

    how can i use state server and a hierarchy of entities as datasource?

    regards
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 21 Jan 2009 Link to this post

    Hello Ibrahim,

    We have a business objects example using List (available here) and you can try using List instead of IList for your scenario.
    You can also use the NeedDataSource event of the report and thus assign the datasource to the "processing report", thus avoiding any need for serialization/deserialization.
    Another approach is to move on to DataSet or DataTable:

    DataTable dt = new DataTable();
                DataColumn col = new DataColumn("ColumnName", typeof(string));
                ....
                dt.Columns.Add(col);
                foreach (object Item in MyIList)
                {
                    DataRow row = dt.NewRow();
                    row["ColumnName"] = Item;
                    .....
                    dt.Rows.Add(row);
                }

    Best wishes,
    Steve
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft banner
  4. Ibrahim Imam
    Ibrahim Imam avatar
    69 posts
    Member since:
    Jul 2007

    Posted 21 Jan 2009 Link to this post

    replacing IList with List completly solved my problem

    thanks
  5. Shawn Krivjansky
    Shawn Krivjansky avatar
    86 posts
    Member since:
    Jan 2010

    Posted 07 Nov 2011 Link to this post

    What EXACTLY does this statement mean?? :
    "You can also use the NeedDataSource event of the report and thus assign the datasource to the "processing report", thus avoiding any need for serialization/deserialization."

    I am using the latest version of Telerik Reporting and using "StateServer" for session state.

    I have something like this:
    Partial Public Class myReport4
        Inherits Telerik.Reporting.Report
     
        Public Sub New()
            InitializeComponent()
            'Me.LoadData()
        End Sub
     
        Private Sub myReport4_NeedDataSource(sender As Object, e As System.EventArgs) Handles Me.NeedDataSource
            Me.LoadData()
        End Sub
        Private Sub LoadData()
     
            Dim dbContextMaster As New HRnetMasterDataModel()
            Dim ds = dbContextMaster.TenantMasters.ToList
     
            Me.DataSource = ds
     
        End Sub



    It would appear to me that I AM implementing the "NeedDataSource", but yet at runtime (in a web app report viewer control) I get the "unable to serialize the session state" error message.  So, what do I need to do to get this to work? Or, am I not understanding the instructions??
  6. Shawn Krivjansky
    Shawn Krivjansky avatar
    86 posts
    Member since:
    Jan 2010

    Posted 07 Nov 2011 Link to this post

    Nevermind.

    I think I get it now.

    "Processing Report" is a class and DIFFERENT than the normal "report" (this,me).

    I was assigning to the datasouce of ME and not to Processing.Report.Datasource.

    That cleared it up for me.
Back to Top
DevCraft banner