Working with WebDataGrid 12.1 (Version=12.1.20121.1005). Have loaded GRID with BatchUpdating="True" and installed a "Save Changes" button. WebDataGrid is bound to a SqlDataSource control.Data is retrieved successfully. When I change one or more rows on the grid and click the "Save Changes' button the values are saved on the grid. However, when I check the data in the database the rows I changed in the grid are not reflected in the table; the data is unchanged. When I click the "Save Changes" button a second time it triggers a postback and the data from the table table is loaded in the grid overwriting the changes I made previously.====================================================================
ENVIRONMENT: VISUAL STUDIO 2008, VB.NET, ASP.NET Framework 3.5, NetAdvantage Select 2012 Vol. 1
====================================================================Source code for the grid...
<ig:WebDataGrid ID="wdgReference" runat="server" AutoGenerateColumns="False"AutoCRUD="false"DataKeyFields="APP,CATEGORY,SUBCATEGORY,KEY,VALUE,CRET_TMSTP"DataSourceID="SqlDataSource1"Height="420px" Width="1091px" CssClass="accordionHeaderSelected">
<EditorProviders><ig:DatePickerProvider ID="ExpirationProvider" /><ig:DatePickerProvider ID="EffectiveDateProvider" /><ig:DateTimeEditorProvider ID="EffectiveDate_DateTimeProvider" /><ig:DateTimeEditorProvider ID="ExpirationDate_DateTimeProvider" /></EditorProviders>
<Columns><ig:BoundDataField DataFieldName="APP" Key="APP"> <Header Text= "APP" /></ig:BoundDataField><ig:BoundDataField DataFieldName="CATEGORY" Key="CATEGORY"> <Header Text= "CATEGORY" /></ig:BoundDataField><ig:BoundDataField DataFieldName="SUBCATEGORY" Key="SUBCATEGORY"> <Header Text= "SUBCATEGORY" /></ig:BoundDataField><ig:BoundDataField DataFieldName="KEY" Key="KEY"> <Header Text= "KEY" /></ig:BoundDataField><ig:BoundDataField DataFieldName="VALUE" Key="VALUE"> <Header Text= "VALUE" /></ig:BoundDataField><ig:BoundDataField DataFieldName="EFF_DT" Key="EFF_DT"> <Header Text= "EFF_DT" /></ig:BoundDataField><ig:BoundDataField DataFieldName="EXP_DT" Key="EXP_DT"> <Header Text= "EXP_DT" /></ig:BoundDataField><ig:BoundDataField DataFieldName="COMMENTS" Key="COMMENTS"> <Header Text= "COMMENTS" /></ig:BoundDataField><ig:BoundDataField DataFieldName="CRET_TMSTP" Key="CRET_TMSTP"Hidden="true"> <Header Text="CRET_TMSTP" /></ig:BoundDataField> </Columns>
<Behaviors> <ig:Activation Enabled="true" /> <ig:Selection RowSelectType="Multiple" CellClickAction="Row" Enabled="true" /> <ig:EditingCore BatchUpdating="True"> <Behaviors> <ig:CellEditing EditModeActions-EnableF2="true" EditModeActions-MouseClick="Single" Enabled="true"> <ColumnSettings> <ig:EditingColumnSetting ColumnKey="APP" ReadOnly="true" /> <ig:EditingColumnSetting ColumnKey="CATEGORY" ReadOnly="true" /> <ig:EditingColumnSetting ColumnKey="SUBCATEGORY" ReadOnly="true" /> <ig:EditingColumnSetting ColumnKey="KEY" ReadOnly="true" /> <ig:EditingColumnSetting ColumnKey="EFF_DT" EditorID="EffectiveDateProvider" ReadOnly="false" /> <ig:EditingColumnSetting ColumnKey="EXP_DT" EditorID="ExpirationProvider" ReadOnly="false" /> </ColumnSettings> <EditModeActions MouseClick="Single" /></ig:CellEditing><ig:RowAdding Alignment="Top" EditModeActions-EnableF2="true" EditModeActions-EnableOnActive="true"EditModeActions-MouseClick="Single" Enabled="true" ><EditModeActions EnableOnActive="True" MouseClick="Single" /></ig:RowAdding><ig:RowDeleting Enabled="false" /></Behaviors></ig:EditingCore><ig:Paging PageSize="50"></ig:Paging><ig:Sorting SortingMode="Multi"></ig:Sorting><ig:ColumnResizing>
<ColumnSettings> <ig:ColumnResizeSetting ColumnKey="CATEGORY" /> <ig:ColumnResizeSetting ColumnKey="SUBCATEGORY" /> <ig:ColumnResizeSetting ColumnKey="APP" /><ig:ColumnResizeSetting ColumnKey="KEY" /></ColumnSettings></ig:ColumnResizing></Behaviors></ig:WebDataGrid>==============================================================Source Code for the SQLDataSource<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:webprodConnectionString %>" ProviderName="<%$ ConnectionStrings:webprodConnectionString.ProviderName %>" UpdateCommand= "UPDATE WP.XENIT_TCODES_V2 SET VALUE = ?, COMMENTS = ?, EFF_DT = ?, EXP_DT = ? WHERE APP = ? AND CATEGORY = ? AND SUBCATEGORY = ? AND KEY = ? " SelectCommand="SELECT APP, CATEGORY, SUBCATEGORY, KEY, VALUE, COMMENTS, EFF_DT, EXP_DT, CRET_USER_ID, CHAR(CRET_TMSTP) AS CRET_TMSTP FROM WP.XENIT_TCODES_V2 ORDER BY APP, CATEGORY, SUBCATEGORY, KEY, VALUE FOR READ ONLY WITH UR"> <UpdateParameters> <asp:Parameter Name="VALUE" Type="String" /> <asp:Parameter Name="COMMENTS" Type="String" /> <asp:Parameter Name="EFF_DT" Type="DateTime" /> <asp:Parameter Name="EXP_DT" Type="DateTime" /> <asp:Parameter Name="APP" Type="String" /> <asp:Parameter Name="CATEGORY" Type="String" /> <asp:Parameter Name="SUBCATEGORY" Type="String" /> <asp:Parameter Name="KEY" Type="String" /> </UpdateParameters> </asp:SqlDataSource>
==============================================================
Any help anyone can provide is greatly appreciated.Thank you for your help...
Peter,
I got the web data grid working successfully for adds, updates and logical deletes on a table with a single primary key.
When I test against a table with a composite key I get the following results:(1) INSERT - successful(2) DELETE - successful... This is a logical delete (ie., I perform an update and set a timestamp)(3) UPDATE - I do not see any errors but the changes are not persisted to the database.
Zip file attached.Thank you for your help...
Hello dhmimels,
Please feel free to contact me if you have any further questions regarding this matter.
Hello dhimmels,
Thank you for posting in the community.
Examining the code you have provided, I can see no issues with your setup. However the AutoCRUD property which you have defined inside the ig:WebDataGrid tag does not exist there (this property is specific to the editing core). Please note that if you are setting AutoCRUD to false for the editing core somewhere else, the datasource updates are to be configured manually.
In order to provide more adequate feedback for this scenario I would need a small sample illustrating the scenario.
Please do not hesiate to contact me if you have any questions.