troubleshooting Question

Unable to delete or update ASP GridView

Avatar of centem
centemFlag for United States of America asked on
ASP.NET
4 Comments3 Solutions476 ViewsLast Modified:
Please help. Why won't this gridview delete when I click on the delete button or update when I click on the update button. Below is the entire gridview code.
 
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
             AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="id"
             DataSourceID="SqlDataSource1">
             <Columns>
                 <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                 <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False"
                     ReadOnly="True" SortExpression="id" Visible="False" />
                 <asp:BoundField DataField="Userid" HeaderText="Userid" ReadOnly="True"
                     SortExpression="Userid" />
                 <asp:BoundField DataField="FirstN" HeaderText="FirstN" ReadOnly="True"
                     SortExpression="FirstN" />
                 <asp:BoundField DataField="LastN" HeaderText="LastN" ReadOnly="True"
                     SortExpression="LastN" />
                 <asp:BoundField DataField="MiddleI" HeaderText="MiddleI" ReadOnly="True"
                     SortExpression="MiddleI" />
                 <asp:BoundField DataField="Location" HeaderText="Location" ReadOnly="True"
                     SortExpression="Location" />
                 <asp:BoundField DataField="IACertificationDate"
                     HeaderText="IACertificationDate" SortExpression="IACertificationDate" />
             </Columns>
         </asp:GridView>
         <asp:SqlDataSource ID="SqlDataSource1" runat="server"
             ConflictDetection="CompareAllValues"
             ConnectionString="<%$ ConnectionStrings:nodiiguard_u2kdbConnectionString %>"
             DeleteCommand="DELETE FROM [U2K_UserList] WHERE [id] = @original_id AND (([Userid] = @original_Userid) OR ([Userid] IS NULL AND @original_Userid IS NULL)) AND (([FirstN] = @original_FirstN) OR ([FirstN] IS NULL AND @original_FirstN IS NULL)) AND (([LastN] = @original_LastN) OR ([LastN] IS NULL AND @original_LastN IS NULL)) AND (([MiddleI] = @original_MiddleI) OR ([MiddleI] IS NULL AND @original_MiddleI IS NULL)) AND (([Location] = @original_Location) OR ([Location] IS NULL AND @original_Location IS NULL)) AND (([IACertificationDate] = @original_IACertificationDate) OR ([IACertificationDate] IS NULL AND @original_IACertificationDate IS NULL))"
             InsertCommand="INSERT INTO [U2K_UserList] ([Userid], [FirstN], [LastN], [MiddleI], [Location], [IACertificationDate]) VALUES (@Userid, @FirstN, @LastN, @MiddleI, @Location, @IACertificationDate)"
             OldValuesParameterFormatString="original_{0}"
             SelectCommand="SELECT [id], [Userid], [FirstN], [LastN], [MiddleI], [Location], [IACertificationDate] FROM [U2K_UserList]"
             UpdateCommand="UPDATE [U2K_UserList] SET [Userid] = @Userid, [FirstN] = @FirstN, [LastN] = @LastN, [MiddleI] = @MiddleI, [Location] = @Location, [IACertificationDate] = @IACertificationDate WHERE [id] = @original_id AND (([Userid] = @original_Userid) OR ([Userid] IS NULL AND @original_Userid IS NULL)) AND (([FirstN] = @original_FirstN) OR ([FirstN] IS NULL AND @original_FirstN IS NULL)) AND (([LastN] = @original_LastN) OR ([LastN] IS NULL AND @original_LastN IS NULL)) AND (([MiddleI] = @original_MiddleI) OR ([MiddleI] IS NULL AND @original_MiddleI IS NULL)) AND (([Location] = @original_Location) OR ([Location] IS NULL AND @original_Location IS NULL)) AND (([IACertificationDate] = @original_IACertificationDate) OR ([IACertificationDate] IS NULL AND @original_IACertificationDate IS NULL))">
             <DeleteParameters>
                 <asp:Parameter Name="original_id" Type="Int32" />
                 <asp:Parameter Name="original_Userid" Type="String" />
                 <asp:Parameter Name="original_FirstN" Type="String" />
                 <asp:Parameter Name="original_LastN" Type="String" />
                 <asp:Parameter Name="original_MiddleI" Type="String" />
                 <asp:Parameter Name="original_Location" Type="String" />
                 <asp:Parameter Name="original_IACertificationDate" Type="DateTime" />
             </DeleteParameters>
             <InsertParameters>
                 <asp:Parameter Name="Userid" Type="String" />
                 <asp:Parameter Name="FirstN" Type="String" />
                 <asp:Parameter Name="LastN" Type="String" />
                 <asp:Parameter Name="MiddleI" Type="String" />
                 <asp:Parameter Name="Location" Type="String" />
                 <asp:Parameter Name="IACertificationDate" Type="DateTime" />
             </InsertParameters>
             <UpdateParameters>
                 <asp:Parameter Name="Userid" Type="String" />
                 <asp:Parameter Name="FirstN" Type="String" />
                 <asp:Parameter Name="LastN" Type="String" />
                 <asp:Parameter Name="MiddleI" Type="String" />
                 <asp:Parameter Name="Location" Type="String" />
                 <asp:Parameter Name="IACertificationDate" Type="DateTime" />
                 <asp:Parameter Name="original_id" Type="Int32" />
                 <asp:Parameter Name="original_Userid" Type="String" />
                 <asp:Parameter Name="original_FirstN" Type="String" />
                 <asp:Parameter Name="original_LastN" Type="String" />
                 <asp:Parameter Name="original_MiddleI" Type="String" />
                 <asp:Parameter Name="original_Location" Type="String" />
                 <asp:Parameter Name="original_IACertificationDate" Type="DateTime" />
             </UpdateParameters>
         </asp:SqlDataSource>

ASKER CERTIFIED SOLUTION
centem

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros