We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Problem with DataSourceCachingMode

Thread ID:

Created:

Updated:

Platform:

Replies:

130538 May 17,2017 08:40 AM May 25,2017 09:49 PM ASP.NET Web Forms 3
loading
Tags: Grid
marchesini
Asked On May 17, 2017 08:40 AM

Hi

I use the syncfusion grid control. When I set the property  DataSourceCachingMode="ViewState", the control doesn t works. I have this error : “Référence circulaire détectée lors de la sérialisation d'un objet de type 'System.Data.DataView'.

If i put DataSourceCachingMode="none", the controls works, but I don t want to load the grid each post back.

Can you help me?


Thavasianand Sankaranarayanan [Syncfusion]
Replied On May 18, 2017 12:23 PM

Hi Marchesini, 

Thanks for contacting Syncfusion support. 

We have analyzed your query and we suspect that you want to bind the dataTable to the Grid with the dDataSourceCachingMode as viewstate. We are able to reproduce the reported issue from our end. Because binding grid dataTable, when its go for postBack then it will need to get serialize. This is the root cause of the issue. 

Refer the below code example. 


public partial class _Default : Page 
    { 
         
        protected void Page_Load(object sender, EventArgs e) 
        { 
            var datatable = GetGridDT(); 
             
            var emp = (from DataRow row in datatable.Rows 
                       select new OrderTable 
                       { 
                           OrderID = Convert.ToInt32(row["OrderID"]), 
                           CustomerID = row["CustomerID"].ToString(), 
                           EmployeeID = Convert.ToInt32(row["EmployeeID"]), 
                           ShipCountry = row["ShipCountry"].ToString() 
 
                       }).ToList(); 
 
            this.FlatGrid.DataSource = emp; 
        } 
         
         
        public static DataTable GetGridDT() 
        { 
            var connection = ConfigurationManager.ConnectionStrings["NORTHWNDConnectionString"].ConnectionString; 
            var dataTable = new DataTable(); 
            using (var dataAdapter = new SqlDataAdapter("SELECT * from Orders", connection)) 
            { 
 
                dataAdapter.Fill(dataTable); 
 
            } 
            return dataTable; 
        } 


We have prepared a sample and it can be downloadable from the below location. 


If we misunderstood your query then please get back to us. 

Regards, 
Thavasianand S.

marchesini
Replied On May 24, 2017 04:57 AM

Thanks you.

I looked at your solution but the difference is that we use the grid in auto generated column. So with your solution we have the same error message.

Thavasianand Sankaranarayanan [Syncfusion]
Replied On May 25, 2017 09:49 PM

Hi Marchesini, 

We have analyzed your query and we suspect that you want to generate the columns as autogenerated for dataSourceCachingMode as viewState. So, we suggest you to use the DataTableToJson() method to convert the dataTable into Json.  

Refer the below code example. 

 
protected void Page_Load(object sender, EventArgs e) 
        { 
            var datatable = GetGridDT(); 
            var rows = Utils.DataTableToJson(datatable); 
            this.FlatGrid.DataSource = rows; 
        } 
 



                                                                                                                                                                         
  
We have prepared a sample and it can be downloadable from the below location. 


If you still face the same issue then please get back to us. 

Regards, 
Thavasianand S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;