In previous versions of WebDataGrid, if AutoCRUD=false was set, then all the editing could be handled manually. With this current version, the WebDataGrid attempts to lookup all the changed rows by key during a postback even when AutoCRUD=false. If the Grid isn't reloaded at the beginning of the postback or if any of the rows no longer exist an exception occurs: Requested record cannot be found by key. (Infragistics.Web.UI.GridControls.MissingRecordException).
In my web application, the edits are performed first to multiple rows and then the grid is reloaded at the end. Loading it at the beginning too would hurt performance, but the more important problem is that if any of the rows are removed by one user while another user is editing the grid (this is very likely) an exception will occur if the WebDataGrid looks for the missing rows instead of allowing the custom code to handle the updating.
Is there some property other than AutoCRUD that needs to be set for this version to disable the automatic row updating in the WebDataGrid?
Hi,
I have the same exception. I have a grid with 6000 records in it, I use paging with 500 rows.If I edit a row on the first page, and then go to the next page it works fine. But when I go to the eleventh page and change a row there and then go back to one of the first pages I get this exception:[MissingRecordException]: Requested record cannot be found by key.
-I bind my Grid to a generic list which is in a business object I store that in a session.-AutoCrud is on. - I've already tried EnableViewState and EnableDataViewState.
if (Session["TemplateSet"] == null) { TemplateSet = new BillingAllocationSet(); TemplateSet.Fill(6000); // fills the generic list with test data Session["TemplateSet"] = TemplateSet; } else { TemplateSet = Session["TemplateSet"] as BillingAllocationSet; }This is how i bind it. private void BindToGrid() { TemplateGrid.ClearDataSource(); TemplateGrid.DataSource = TemplateSet.BillingAllocationSetItems; TemplateGrid.DataBind(); }
Any suggestions?Regards,
Balazs
If you omit the call to ClearDataSource do you still get that exception?
Hi Nikola,
As Valerie states:
My opinion: If manual CRUD is enabled, the back-end (server side) should be solely responsible for the data handling, and no interference is expected (desired) by the grid code.
Can you submit a bug to our Developer Support system. We will do our best to resolve it ASAP.
Has this been resolved? If so, how can we get the patch?
Ok, so I have spent the past two days tearing my hear out to get a handle on this issue.
I have 2 WebDataGrids.
Grid 1:
<ig:WebDataGrid ID="uwgClasses" runat="server" DataSourceID="sqlClasses" EnableAjax="False" EnableDataViewState="false" EnableViewState="true" AutoGenerateColumns="False" DataKeyFields="ClassNumber" OnRowSelectionChanged="uwgClasses_RowSelectionChanged">
This has paging enabled and the pagination and row selection works a treat. Even across post backs. There is a server side handler for the row selection event and this is getting called AFTER all the Load Events
Grid 2:
<ig:WebDataGrid ID="uwgExhibits" Key="CatalogueNumber" runat="server" EnableViewState="true" AutoGenerateColumns="False" EnableDataViewState="true" DataSourceId="sqlClassEntries" OnRowUpdating="uwgExhibits_RowUpdating" EnableAjax="false" EnableAjaxViewState="true" DataKeyFields="CatalogueNumber" >
I have turned AutoCRUD off for Grid1
The DataSource for grid2 is an ObjectDataSource
When I select a row from grid 1 the following events are being fired in this sequence
Init
LoadViewState
Grid2.DataBound
PageLoad
Grid1.RowSelected
The issue is that the grid on the next postback will point to the second Grid2 data bound grid output, but the grid displayed on the client is set to the initial Grid2 data bound output. I don't seem to be able to override this behaviour and it works as long as I don't try any updates on Grid2. If I do then it can't find the key from the first grid2 in the second grid2 as they are on different pages.
Question: How do you override this initial databinding event and why is the initial grid being returned after postback, is there a cache issue??? Can it be over-ridden???
This seems to happen in other forms as well and having an out of date version of a grid being returned would result in a number of errors. The question is how do you fix it???
PS: I'm currently on a
Cheers
Setting <ig:WebDataGrid EnableDataViewState="True" EnableViewState="True"> works perfectly fine. Thanks.
@HunterDevelopment
What's your DataSource? When and how are you binding it to WebDataGrid?
Ok, so I have managed to find a work around for this, but the update didn't appear to solve the problem.
In the RowSelectionChanged event of Grid1, if you add the lines
(Reset all parameters fo the data source here)
Grid2.ClearDataSource()
Grid2.DataSourceID = "sqlDataSource"
Grid2.DataBind()
The most recent grid is returned to the client and everything works as expected.
If you don't clear the data source the original data source before you reset any parameters is returned.
I set <ig:EditingCore AutoCRUD="False"> in <Behavious> and <ig:WebDataGrid EnableDataViewState="True" EnableViewState="True">. It works fine. I think maybe Infragistics has already fixed the bug because I downloaded the controls on 1/27/2011.