This is a migrated thread and some comments may be shown as answers.

datasource and state server

4 Answers 137 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ibrahim Imam
Top achievements
Rank 1
Ibrahim Imam asked on 20 Jan 2009, 07:28 PM
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

4 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 21 Jan 2009, 02:31 PM
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.
0
Ibrahim Imam
Top achievements
Rank 1
answered on 21 Jan 2009, 05:36 PM
replacing IList with List completly solved my problem

thanks
0
Shawn Krivjansky
Top achievements
Rank 1
answered on 07 Nov 2011, 08:59 PM
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??
0
Shawn Krivjansky
Top achievements
Rank 1
answered on 07 Nov 2011, 09:18 PM
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.
Tags
General Discussions
Asked by
Ibrahim Imam
Top achievements
Rank 1
Answers by
Steve
Telerik team
Ibrahim Imam
Top achievements
Rank 1
Shawn Krivjansky
Top achievements
Rank 1
Share this question
or