Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
710
Adding new row results in 2 entries for that same row in the database.
posted

Adding new row results in 2 entries for that same row in the database.   Using a submit button to refresh. 

  • 710
    posted in reply to Nick

    Hi I am using Infragistics11.1. I have a Webdata grid. I try to add a row to the table at the bottom of the grid. I get to the last field I hit enter. It duplicates the record twice in the database. You can see this in teh last 3 records entered it is duplicating them. 

    Here is the code.

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="testing.aspx.cs" Inherits="FPR.Maintenance.testing" %>

    <%@ Register assembly="Infragistics35.Web.v11.1, Version=11.1.20111.1006, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.GridControls" tagprefix="ig" %>
    <%@ Register assembly="Infragistics35.Web.v11.1, Version=11.1.20111.1006, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI" tagprefix="ig" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
       
            <asp:SqlDataSource ID="SqlDataSource1" runat="server"
                ConnectionString="<%$ ConnectionStrings:FCRRConnectionString %>"
               
               
                SelectCommand="SELECT [PK_staticDocumentID], [bActive], [DocType], [DocName], [bMerged] FROM [tblDocuments_Static]"
                DeleteCommand="DELETE FROM [tblDocuments_Static] WHERE [PK_staticDocumentID] = @PK_staticDocumentID"
                InsertCommand="INSERT INTO [tblDocuments_Static] ([bActive], [DocType], [DocName], [bMerged]) VALUES (@bActive, @DocType, @DocName, @bMerged)"
                UpdateCommand="UPDATE [tblDocuments_Static] SET [bActive] = @bActive, [DocType] = @DocType, [DocName] = @DocName, [bMerged] = @bMerged WHERE [PK_staticDocumentID] = @PK_staticDocumentID">
                <DeleteParameters>
                    <asp:Parameter Name="PK_staticDocumentID" Type="Int32" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:Parameter Name="bActive" Type="Boolean" />
                    <asp:Parameter Name="DocType" Type="String" />
                    <asp:Parameter Name="DocName" Type="String" />
                    <asp:Parameter Name="bMerged" Type="Boolean" />
                    <asp:Parameter Name="PK_staticDocumentID" Type="Int32" />
                </UpdateParameters>
                <InsertParameters>
                    <asp:Parameter Name="bActive" Type="Boolean" />
                    <asp:Parameter Name="DocType" Type="String" />
                    <asp:Parameter Name="DocName" Type="String" />
                    <asp:Parameter Name="bMerged" Type="Boolean" />
                </InsertParameters>
            </asp:SqlDataSource>
            <ig:WebDataGrid ID="WebDataGrid1" runat="server" AutoGenerateColumns="False"
                DataKeyFields="PK_staticDocumentID" DataSourceID="SqlDataSource1"
                Height="350px" Width="400px">
                <Columns>
                    <ig:BoundDataField DataFieldName="PK_staticDocumentID" Hidden="True"
                        Key="PK_staticDocumentID">
                        <header text="PK_staticDocumentID" />
                    </ig:BoundDataField>
                    <ig:BoundCheckBoxField DataFieldName="bActive" Key="bActive">
                        <header text="bActive" />
                    </ig:BoundCheckBoxField>
                    <ig:BoundDataField DataFieldName="DocType" Key="DocType">
                        <header text="DocType" />
                    </ig:BoundDataField>
                    <ig:BoundDataField DataFieldName="DocName" Key="DocName">
                        <header text="DocName" />
                    </ig:BoundDataField>
                    <ig:BoundCheckBoxField DataFieldName="bMerged" Key="bMerged">
                        <header text="bMerged" />
                    </ig:BoundCheckBoxField>
                </Columns>
                <behaviors>
                    <ig:EditingCore>
                        <behaviors>
                            <ig:CellEditing>
                            </ig:CellEditing>
                            <ig:RowAdding>
                                <columnsettings>
                                    <ig:RowAddingColumnSetting ColumnKey="bActive"
                                        DefaultValueAsString="true" />
                                    <ig:RowAddingColumnSetting ColumnKey="bMerged"
                                        DefaultValueAsString="true" />
                                </columnsettings>
                            </ig:RowAdding>
                        </behaviors>
                    </ig:EditingCore>
                    <ig:Selection>
                    </ig:Selection>
                </behaviors>
            </ig:WebDataGrid>
            <ig:WebScriptManager ID="WebScriptManager1" runat="server">
            </ig:WebScriptManager>
       
        </div>
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
        </form>
    </body>
    </html>

  • 385
    posted

    I'm not quite sure what you're asking. Can you elaborate on what you're doing?