Hi,
I've got the latest version of UltraWebGrid, I wish to load a large amount of data into it (about 100,000 rows) so I need to use LoadOnDemand. I have set LoadOnDemand=XML and everything works fine until I attempt to edit a cell which is after the first page of 50 (i.e. one of the cells which has been loaded on demand). I also use a LinqDataSource to poplate the UltraWebGrid if that is of interest
When I edit a cell which is after the first 50 I get told that:Could not find a row that matches the given keys in the original values stored in ViewState. Ensure that the 'keys' dictionary contains unique key values that correspond to a row returned from the previous Select operation.
This happends when I attempt to update the LinqDataSource...
I've read other forum posts which mention that because LoadOnDemand is used the web page can't persist the records beyound the first 50, this I can understand but is there any sort of work around other than turning off LoadOnDemand which is kind of essential when I'm dealing with so much data.
Does anyone have any ideas?
ThanksEd
Are you binding the DataSource in InitializeDatasource?
What is your code in UpdateRow event?
Could you upload sample?
The DataSource is being bound via the DataSourceID property in the aspx file:
<
igtbl:ultrawebgrid ID="UltraWebGrid1" runat="server" Height="200px" Width="700px" Browser="Xml" DataKeyField="UniqueID" OnUpdateCell="UltraWebGrid1_UpdateCell" DataSourceID="LinqDataSource1" EnableViewState="true" >
....</igtbl:ultrawebgrid><asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="XYZ" TableName="XYZ" EnableDelete="True" EnableInsert="True" EnableUpdate="True" EnableViewState="true" StoreOriginalValuesInViewState="true"></asp:LinqDataSource>
I'm using the UpdateCell event:
Public
Sub UltraWebGrid1_UpdateCell(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.CellEventArgs)
Try'Call update on the adapter to commit the changes, catch any exceptions that may be raised.
Dim keyValues As New ListDictionary()Dim newValues As New ListDictionary()Dim oldValues As New ListDictionary()
Dim UniqueIDval As String = e.Cell.Row.DataKey.ToString
keyValues.Add(
"UniqueID", UniqueIDval)oldValues.Add("WHO", e.Data.ToString)newValues.Add("WHO", e.Cell.Text())
LinqDataSource1.Update(keyValues, newValues, oldValues)
'LinqDataSource1.Update(dataSet11)
Catch updateError As Exception
Console.Write(updateError.StackTrace)
End Try
As I said earlier this event works just fine for the forst 50 items loaded, its the ones which appear when they are loaded on demand it doesn't work, the DataKey is worked out ok, it fails on the: LinqDataSource1.Update(keyValues, newValues, oldValues) line.
Any help would be great.
Ed
Thanks for the idea, Iwould never has guessed that applying the datasrouce from code behind would make a difference, I guess it's the
UltraWebGrid1_InitializeDataSource() method that gets it all to work.
I've done this now and everything works great.
Many thanks
Have you tried to bind the data directly to the Datasource attribute instead of using the DatasourceID? I know that this requires some amount of work (manually setting databinding in code behind; manually creating the columns etc.), but I've got the hunch that using the DatasourceID along with the advanced features like Load On Demand doesn't function correctly.
For help in rewriting your app, please look at the thread " Load On Demand doesn't work" where HBA helped me to change my application to not using DatasourceID.
Yes, as I said it works perfecly for the first 50 row's, it's just the 50+ rows which cause problems. I can read the new values in but the LinqToDataSource can't do an update as it seems the values aren't persisted, possibly due to AJAX?
I'm really not sure if this is an issue with Infragistics or not.
Hi!
You wrote "the DataKey is worked out ok". Does that mean that you can read all relevant arguments (UniqueIDval, oldValues, newValues) when UpdateCell is fired on the 50+ row? I mean, have you checked via Debugger or any other means that the data is really there when you call the Update method?
I'm asking because I have a similar case when using the Doubeclick event. In this case there's no active row available on the server side.