grid.DataSource and Cache Data

7 replies. Last post: September 10, 2009 12:04 PM by Jimmy Petrus
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Arun IyerMember

Hi,

This is a new Issue which we are having after the Grid update recently.

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

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 = '" + _checkedRowKey + "'")

end sub

We are binding the grid using the Initialize datasource event as below .

 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

 

This grid on  this page(page1) shows the records which I add through another page(page2).

Steps to recreate the actual issue .

1.Go to page1 to view the records.It displayes the record

2. Go to page2 to Add more records and add more records.

3.Go to Page1 to view the added records.The newly added records is shown correctly

4.Now click on the Image button column of the newly added record.

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.

The BUG here is grid.datasource is still having the old record count.the count before adding the records through page page2.

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?

THIS IS  A NEW BUG HAPPENING AFTER THE NEW GRID UPDATE.WE HAD HIS CODE USED SINCE 1 YEAR WITHOUT ANY ISSUE.

Please find a solution for this ASAP.This is straight  forward to reproduce.

 

Thanks

Arun

 

 

 

All times are GMT -5. The time now is 11:32 PM.
Previous Next