﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebGrid Enterprise - grid.DataSource and Cache Data</title><link>http://www.intersoftsolutions.com/Community/WebGrid/gridDataSource-and-Cache-Data/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>grid.DataSource and Cache Data</title><link>http://www.intersoftsolutions.com/Community/WebGrid/gridDataSource-and-Cache-Data/</link><pubDate>Thu, 10 Sep 2009 12:04:43 GMT</pubDate><dc:creator>jimmyps</dc:creator><description>&lt;p&gt;If it's easy enough for you to reproduce the issue in a simple sample, you can zip the sample project along with required sample database and files in the attachment. I'll help you take a look and give a quick shot on it.&lt;/p&gt;</description></item><item><title>grid.DataSource and Cache Data</title><link>http://www.intersoftsolutions.com/Community/WebGrid/gridDataSource-and-Cache-Data/</link><pubDate>Thu, 10 Sep 2009 12:02:10 GMT</pubDate><dc:creator>aiyer</dc:creator><description>&lt;p&gt;Thanks for the update James.Still I am having the issue with this settings.&lt;/p&gt;</description></item><item><title>grid.DataSource and Cache Data</title><link>http://www.intersoftsolutions.com/Community/WebGrid/gridDataSource-and-Cache-Data/</link><pubDate>Thu, 10 Sep 2009 10:19:34 GMT</pubDate><dc:creator>james</dc:creator><description>&lt;p&gt;Arun,&lt;/p&gt;&lt;p&gt;With the setting turned off, the data caching will still work in subsequent postback and FlyPostBack requests. However, the data cache will be invalidated on first page load (non postback condition).&lt;/p&gt;
&lt;p&gt;Looking at your scenario, I'd suggest you to set the AlwaysUseCachedDataOnFirstLoad property to false to ensure your data is fresh upon first load.&lt;/p&gt;
&lt;p&gt;The GetCachedDataSource is the correct method to get cached data, and not .DataSource property. &lt;/p&gt;</description></item><item><title>grid.DataSource and Cache Data</title><link>http://www.intersoftsolutions.com/Community/WebGrid/gridDataSource-and-Cache-Data/</link><pubDate>Thu, 10 Sep 2009 09:39:11 GMT</pubDate><dc:creator>aiyer</dc:creator><description>&lt;p&gt;Hi James,&lt;/p&gt;
&lt;p&gt;This won't work.If you set &lt;strong&gt;AlwaysUseCachedDataOnFirstLoad="False" &lt;/strong&gt;,how will the grid cache the data.Then &lt;strong&gt;GetCachedDataSource&lt;/strong&gt; will be nothing then.&lt;/p&gt;
&lt;p&gt;Any other solution?&lt;/p&gt;
&lt;p&gt;Intersoft support help us to resolve this without a sample application....&lt;/p&gt;
&lt;p&gt;Arun&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description></item><item><title>grid.DataSource and Cache Data</title><link>http://www.intersoftsolutions.com/Community/WebGrid/gridDataSource-and-Cache-Data/</link><pubDate>Tue, 08 Sep 2009 11:10:23 GMT</pubDate><dc:creator>james</dc:creator><description>&lt;p&gt;Aiyer, &lt;/p&gt;&lt;p&gt;Firstly, make sure that the always load cache on page load setting is set to false. The setting can be accessed in grid.LayoutSettings.&lt;b&gt;AlwaysUseCachedDataOnFirstLoad&lt;/b&gt;.&lt;/p&gt;
&lt;p&gt;Then, you should use grid.&lt;b&gt;GetCachedDataSource&lt;/b&gt;() method in order to get the cached data source instead of .DataSource and cast it to appropriate datasource type.&lt;/p&gt;
&lt;p&gt;Let me know if that helps.&lt;/p&gt;
&lt;p&gt;- James.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>grid.DataSource and Cache Data</title><link>http://www.intersoftsolutions.com/Community/WebGrid/gridDataSource-and-Cache-Data/</link><pubDate>Tue, 08 Sep 2009 09:46:05 GMT</pubDate><dc:creator>aiyer</dc:creator><description>&lt;p&gt;HI,&lt;/p&gt;
&lt;p&gt;Answer to your question .&lt;/p&gt;
&lt;p&gt;1. In Step2 I add records through a storedprocedure.&lt;/p&gt;
&lt;p&gt;2.In step3,I view the added records by going directly into page1.In page1 the data bind is done in InitializeDataSource as specified in my first mail.there is no call to refresh.&lt;/p&gt;
&lt;p&gt;this is really something to do with session and cached data because if I logout(i clear all session here) from my software and login again and goes to page1.the data is displayed correctly and button click event works fine with correct record count.&lt;/p&gt;
&lt;p&gt;Arun&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description></item><item><title>grid.DataSource and Cache Data</title><link>http://www.intersoftsolutions.com/Community/WebGrid/gridDataSource-and-Cache-Data/</link><pubDate>Tue, 08 Sep 2009 03:13:02 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><description>&lt;p&gt;Hi Arun,&lt;/p&gt;&lt;p&gt;I will need to replicate your issue in here. Is it possible for you to help me replicate it in simple sample/scenario?&lt;/p&gt;
&lt;p&gt;Besides that, i also need to know the following details below:&lt;/p&gt;
&lt;p&gt;Step2, what did you use to add new records? &lt;/p&gt;
&lt;p&gt;Step3, how you view the added records (such as refresh and etc)?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>grid.DataSource and Cache Data</title><link>http://www.intersoftsolutions.com/Community/WebGrid/gridDataSource-and-Cache-Data/</link><pubDate>Mon, 07 Sep 2009 12:53:00 GMT</pubDate><dc:creator>aiyer</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This is a new Issue which we are having after the Grid update recently.&lt;/p&gt;
&lt;p&gt;I have my first page(page1) with selfreferencing grid load on demand set to true.The Grid is having setting DataCacheStorage="session".This grid is having a column of type columType="ButtonImage" and the below server code&lt;/p&gt;&lt;pre&gt;Protected Sub grid_ButtonClick(ByVal sender As Object, ByVal e As ISNet.WebUI.WebGrid.ButtonEventArgs)
Dim _checkedRowKey As String = grid.SelectedRowKeyValue

        Dim ds1 As DataTable = CType(grid.DataSource, DataTable)
        Dim drv As DataRow() = ds1.Select("id = '" &amp;#43; _checkedRowKey &amp;#43; "'")

end sub&lt;/pre&gt;

&lt;p&gt;We are binding the grid using the Initialize datasource event as below .&lt;/p&gt;&lt;pre&gt;
 Protected Sub grd_InitializeDataSource(ByVal sender As Object, _
 
            Dim _cours As New myobject

	   _cours.GetMyParentRecords(1, sid, Session(gs_USERSTATE).UserID, -1, False)
            grd.ClearCachedDataSource() ' added this code to clear cache,BUG still exists without this code
            e.DataSource = _cours.DefaultView.Table

 end sub

&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;
&lt;p&gt;This grid on  this page(page1) shows the records which I add through another page(page2).&lt;/p&gt;
&lt;p&gt;Steps to recreate the actual issue .&lt;/p&gt;
&lt;p&gt;1.Go to page1 to view the records.It displayes the record&lt;/p&gt;
&lt;p&gt;2. Go to page2 to Add more records and add more records.&lt;/p&gt;
&lt;p&gt;3.Go to Page1 to view the added records.The newly added records is shown correctly&lt;/p&gt;
&lt;p&gt;4.Now click on the Image button column of the newly added record.&lt;/p&gt;
&lt;p&gt;put a break point in the above button click event code.The value of grid.SelectedRowKey is showing correctly.Now the datarow 'drv' row count will  be zero.It fails to find the selected record. &lt;/p&gt;
&lt;p&gt;The BUG here is grid.datasource is still having the old record count.the count before adding the records through page page2.&lt;/p&gt;
&lt;p&gt;Why the grid fails to find new records in the button click code even though the records are visible and the selectedRowKey values are correct?&lt;/p&gt;
&lt;p&gt;THIS IS  A NEW BUG HAPPENING AFTER THE NEW GRID UPDATE.WE HAD HIS CODE USED SINCE 1 YEAR WITHOUT ANY ISSUE.&lt;/p&gt;
&lt;p&gt;Please find a solution for this ASAP.This is straight  forward to reproduce.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Arun&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description></item></channel></rss>