Avatar of sammySeltzer
sammySeltzer
Flag for United States of America

asked on 

Gridview Update command not updating all records, urgent PLEASE!!!

Greetings again, mates,

I have my application go LIVE today, a very highly visible application.

However, the users are not able to edit their records for whatever reason.

What they tell us is that they are able to edit ONLY the first row. No other rows edit.

They make their changes, click update but instead of updatting, the cursor moves to next record.

Can you please, please take a look and help figure out what could be wrong?

I can't find it and I have been looking at this now for 2 hours.

Many, many thanks for your kind and urgent response.

Here is the real code:

        <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" 
            AutoGenerateColumns="False" DataKeyNames="ID" AllowPaging="True" 
            CellPadding="4" ForeColor="#333333" GridLines="None" Visible="True" 
            OnRowDataBound="gvRowDataBound" OnRowUpdated="GridView1_RowUpdated" AutoGenerateEditButton="True">
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <Columns>
                <asp:BoundField DataField="ID" HeaderText="ID" Visible = "false"
                    ReadOnly="True" SortExpression="ID" />
                <asp:BoundField DataField="charity_code" HeaderText="Charity Code" 
                    SortExpression="charity_code" />
                <asp:BoundField DataField="chcknum" HeaderText="Check Number" 
                    SortExpression="chcknum" />
                <asp:BoundField DataField="check_amt" HeaderText="Check Amount" DataFormatString="{0:c2}" 
                    SortExpression="check_amt" />
                <asp:BoundField DataField="one_time" HeaderText="One Time Amount" DataFormatString="{0:c2}" 
                    SortExpression="one_time" />
                <asp:BoundField DataField="bi_weekly" HeaderText="Bi-Weekly Amount" DataFormatString="{0:c2}" 
                    SortExpression="bi_weekly" />
                <asp:BoundField DataField="cash" HeaderText="Cash Amount" SortExpression="cash" DataFormatString="{0:c2}" />
                <asp:BoundField DataField="donate_choice" HeaderText="Donate" ReadOnly = "true"
                    SortExpression="donate_choice" />
                <asp:BoundField DataField="date_stamp" HeaderText="Entry Date" ReadOnly = "true"
                    SortExpression="date_stamp" />
            </Columns>
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
           </asp:GridView>
           <asp:HiddenField ID="dchide" runat="server" ></asp:HiddenField>
           <asp:HiddenField ID="idhide" runat="server" ></asp:HiddenField>
           <asp:HiddenField ID="ssnhide" runat="server" ></asp:HiddenField>
           <asp:HiddenField ID="pledgehide" runat="server" ></asp:HiddenField>
           <asp:HiddenField ID="idapp" runat="server" ></asp:HiddenField>
           <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:Database_DBConnectionString %>" 
            SelectCommand=" SELECT DA.ID, DA.employee_ID, DA.charity_code, CASE WHEN isnull(DA.chcknum, '')  = '' AND isnull(cash, 0) <> 0 THEN 'Cash Payment' ELSE chcknum END As chcknum, DA.check_amt, DA.one_time, DA.bi_weekly, DA.cash, DA.donate_choice, DA.date_stamp, DA.amb_approved, AE.dept_code, AE.empl_first, AE.empl_last
                          FROM employee_ded_amts as DA INNER JOIN active_empl as AE ON DA.employee_ID = AE.employee_id
                          WHERE (AE.dept_code = @dchide and AE.pledged=@pledgehide AND (DA.cash <> 0 or DA.check_amt <> 0)) ORDER BY DA.employee_ID" 
            UpdateCommand="UPDATE [employee_ded_amts] SET [charity_code] = @charity_code, [chcknum] = @chcknum, [check_amt] = @check_amt, [one_time] = @one_time, [bi_weekly] = @bi_weekly, [cash] = @cash,  [amb_approved] = @amb_approved WHERE [ID] = @ID">
            <UpdateParameters>
                <asp:Parameter Name="employee_ID" Type="String" />
                <asp:Parameter Name="charity_code" Type="String" />
                <asp:Parameter Name="chcknum" Type="String" />
                <asp:Parameter Name="check_amt" Type="Decimal" />
                <asp:Parameter Name="one_time" Type="Decimal" />
                <asp:Parameter Name="bi_weekly" Type="Decimal" />
                <asp:Parameter Name="cash" Type="Decimal" />
                <asp:Parameter Name="donate_choice" Type="String" />
                <asp:Parameter Name="date_stamp" Type="DateTime" />
                <asp:Parameter Name="amb_approved" Type="String" />
                <asp:Parameter Name="ID" Type="Int32" />
            </UpdateParameters>

Open in new window

ASP.NETVisual Basic.NET

Avatar of undefined
Last Comment
sammySeltzer

8/22/2022 - Mon