Replies
Hi Hristo
Thank you very much – your fix did resolve the problem!
I have one question though: As the rowUpdating event is called for every row that is being updated – wont the grid be bound to the datasource n times for n-rows?
It's not a big deal, I'm just curious and noticed that it becomes a bit slower with every row that I edit.
Thanks again!
Kevin
Hello Hristo
I tried to create a working example showing the issue. Like I said, I don’t believe it’s a problem/bug, I must be doing something wrong. Probably I’m using wrong events or forget something.
As for the example, please note that it is much simplified and is using an IList as a fake-kind of repository and as a replacement for a DataBase. In reality, I use an SQL Database and typed DataSets / TableAdapters to fill the DataSet that is bound to the grid, but it is easier this way than sending you a dump of my SQL database – the problem still appears. Please notice that only the Salary is updated in this example. Just Change one of the employees salary to any value, press save and see how the Grid is not updated, until you manually do it pressing F5.
To remind you shortly of my issue/scenario:
WHDG <– local dataset as a datasource=<– tableadapter <– SQL DB
In the RowEditing event, I’m directly updating the SQL Database (or in the example project, the List), but after the PostBack is finished and the page is displayed, the grid is still showing the old values, until I reload (F5) the page again.
I hope you can help me. Thanks a lot, Kevin
Hi Hristo, thanks for your help. Unfortunately, setting enableAjax to false and calling DataBind() in the rowUpdating event didn’t resolve the problem.
Protected Sub WebHierarchicalDataGrid1_RowUpdating(sender As Object, e As Infragistics.Web.UI.GridControls.RowUpdatingEventArgs) Handles WebHierarchicalDataGrid1.RowUpdating For i As Integer = 0 To e.OldValues.Count - 1 Dim key As String = e.OldValues.Keys(i) Dim oldValue As String = e.OldValues.Values(i) Dim newValue As String = e.Values(key) If (oldValue <> newValue) Then Dim period As String = e.Row.Items.FindItemByKey(key).Column.Header.Text Dim decimalValue As Nullable(Of Decimal) If newValue = 0 Then decimalValue = Nothing Else decimalValue = newValue End If employeeTableAdapter.UpdateValues(e.Row.Items(0).Value, e.Row.Items(1).Value, e.Row.Items(3).Value, CUInt(period), decimalValue) End If Next End Sub
And here the code of my WebHierarchicalDataGrid:
<ig:WebHierarchicalDataGrid ID=”WebHierarchicalDataGrid1″ runat=”server” AutoGenerateColumns=”False” StyleSetName=”Office2010Blue” Width=”1160px” Height=”500px” ItemCssClass=”borderClass” EnableAjax=”False”>
<GroupingSettings EnableColumnGrouping=”True”>GroupingSettings>
<Columns>
<ig:BoundDataField DataFieldName=”MA_ID” Hidden=”True” Key=”MA_ID” Width=”60px”> <Header Text=”MA_ID”> Header> ig:BoundDataField>
// tons of column definitions…
Columns>
<Behaviors>
<ig:EditingCore AutoCRUD=”False” BatchUpdating=”True”>
<Behaviors>
<ig:CellEditing><CellEditingClientEvents EnteringEditMode=”WebDataGrid1_CellEditing_EnteringEditMode” ExitedEditMode=”WebDataGrid1_CellEditing_ExitedEditMode” />
<ColumnSettings>
<ig:EditingColumnSetting ColumnKey=”MA_ID” ReadOnly=”true” />
<ig:EditingColumnSetting ColumnKey=”KeyDescription” ReadOnly=”true” />
ColumnSettings>
ig:CellEditing>
Behaviors>
ig:EditingCore>
<ig:Sorting>
ig:Sorting>
<ig:ColumnMoving>
ig:ColumnMoving>
<ig:ColumnResizing>
ig:ColumnResizing>
Behaviors>
ig:WebHierarchicalDataGrid>
I’m only using the WebHierarchicalDataGrid instead of a WebDataGrid because of it’s Excel style columnGrouping feature.
thanks a lot for your help
Kevin