My Gridview won't update. What am I missing?

Dear Experts,
I've looked and looked at this markup/code and can't figure out why when I click "Update" on the gridview the page posts back as if the update occurred but no changes show up neither in the Gridview nor in the database. Can you find what I'm missing?
Thanks.

<asp:GridView ID="gvChecklist" runat="server" AutoGenerateColumns="False" DataSourceID="sdsChecklist" Style="text-align: center">
                    <Columns>
                        <asp:CommandField ShowEditButton="True" ControlStyle-Width="40px">
                            <ControlStyle Width="40px"></ControlStyle>
                        </asp:CommandField>
                        <asp:BoundField DataField="StudentName" HeaderText="Name" SortExpression="StudentName">
                            <ControlStyle Width="200px" />
                            <FooterStyle Width="320px" />
                            <HeaderStyle Width="320px" CssClass="PanelTitle" />
                            <ItemStyle Width="320px" />
                        </asp:BoundField>
                        <asp:TemplateField HeaderText="Assigned?" SortExpression="InterventionCheckbox">
                            <EditItemTemplate>
                                <asp:CheckBox ID="ckbxAssigned" runat="server" Checked='<%# Bind("InterventionCheckbox") %>' />
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:CheckBox ID="ckbxAssigned" runat="server" Checked='<%# Bind("InterventionCheckbox") %>' Enabled="false" />
                            </ItemTemplate>
                            <ControlStyle Width="90px" />
                            <FooterStyle Width="90px" />
                            <HeaderStyle CssClass="PanelTitle" Width="90px" />
                            <ItemStyle Width="90px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Date" SortExpression="InterventionDate">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtInterventionDate" runat="server" Text='<%# Bind("InterventionDate") %>'></asp:TextBox>
                                <ajaxToolkit:CalendarExtender ID="txtInterventionDate_CalendarExtender" runat="server" BehaviorID="txtInterventionDate_CalendarExtender" TargetControlID="txtInterventionDate" />
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# Bind("InterventionDate", "{0:d}") %>'></asp:Label>
                            </ItemTemplate>
                            <ControlStyle Width="90px" />
                            <FooterStyle Width="90px" />
                            <HeaderStyle CssClass="PanelTitle" Width="90px" />
                            <ItemStyle Width="90px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Completed?" SortExpression="CompletedCheckBox">
                            <EditItemTemplate>
                                <asp:CheckBox ID="ckbxCompleted" runat="server" Checked='<%# Bind("CompletedCheckBox") %>' />
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:CheckBox ID="ckbxCompleted" runat="server" Checked='<%# Bind("CompletedCheckBox") %>' Enabled="false" />
                            </ItemTemplate>
                            <ControlStyle Width="90px" />
                            <FooterStyle Width="90px" />
                            <HeaderStyle CssClass="PanelTitle" Width="90px" />
                            <ItemStyle Width="90px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Date" SortExpression="CompletedDate">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtCompletedDate" runat="server" Text='<%# Bind("CompletedDate") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label2" runat="server" Text='<%# Bind("CompletedDate", "{0:d}") %>'></asp:Label>
                            </ItemTemplate>
                            <ControlStyle Width="90px" />
                            <FooterStyle Width="90px" />
                            <HeaderStyle CssClass="PanelTitle" Width="90px" />
                            <ItemStyle Width="90px" />
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>

      <asp:SqlDataSource ID="sdsChecklist" runat="server" ConnectionString="<%$ ConnectionStrings:ICSS %>"
          DeleteCommand="DELETE FROM [Interventions] WHERE [InterventionRecordId] = @InterventionRecordId"
          InsertCommand="INSERT INTO [Interventions] ([StudentName], [InterventionCheckBox], [InterventionDate], [CompletedCheckBox], [CompletedDate]) VALUES (@StudentName, @InterventionCheckBox, @InterventionDate, @CompletedCheckBox, @CompletedDate)"
          SelectCommand="SELECT [InterventionRecordId], [StudentName], [InterventionCheckBox], [InterventionDate], [CompletedCheckBox], [CompletedDate] FROM [Interventions] WHERE ([ChecklistAssignedRecordId] = @ChecklistAssignedRecordId)"
          UpdateCommand="UPDATE [Interventions] SET [StudentName] = @StudentName, [InterventionCheckBox] = @InterventionCheckBox, [InterventionDate] = @InterventionDate, [CompletedCheckBox] = @CompletedCheckBox, [CompletedDate] = @CompletedDate WHERE [InterventionRecordId] = @InterventionRecordId">
          <DeleteParameters>
              <asp:Parameter Name="InterventionRecordId" Type="Int32" />
          </DeleteParameters>
          <InsertParameters>
              <asp:Parameter Name="StudentName" Type="String" />
              <asp:Parameter Name="InterventionCheckBox" Type="Boolean" />
              <asp:Parameter DbType="DateTime2" Name="InterventionDate" />
              <asp:Parameter Name="CompletedCheckBox" Type="Boolean" />
              <asp:Parameter DbType="DateTime2" Name="CompletedDate" />
          </InsertParameters>
          <SelectParameters>
              <asp:ControlParameter ControlID="ddlDateAndTitle" Name="ChecklistAssignedRecordId" PropertyName="SelectedValue" Type="Int32" />
          </SelectParameters>
          <UpdateParameters>
              <asp:Parameter Name="StudentName" Type="String" />
              <asp:Parameter Name="InterventionCheckBox" Type="Boolean" />
              <asp:Parameter DbType="DateTime2" Name="InterventionDate" />
              <asp:Parameter Name="CompletedCheckBox" Type="Boolean" />
              <asp:Parameter DbType="DateTime2" Name="CompletedDate" />
              <asp:Parameter Name="InterventionRecordId" Type="Int32" />
          </UpdateParameters>
      </asp:SqlDataSource>
bobbellowsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Easwaran ParamasivamCommented:
Could  you run the profiler and see whether the update statement is being hit while updating? BTW, delete is working fine?

One point I noted is that  DataKeyNames="InterventionRecordID" should be given for the Gridview. Based on this column only the update happens.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bobbellowsAuthor Commented:
Easwaran,
Delete not activated -- even though the controller has the commands -- Records too critical for user to delete. I'm not sure what you mean "the profiler." Even though I've been working with asp.net for some time I've never used gridview till this week.
BB
Easwaran ParamasivamCommented:
Well. Go to SSMS > Tools > Profiler > Give the database details as same as connection string and start.
Perform update in Gridview. The Update command should be hit in the profiler. For more information please look at http://www.codeproject.com/Articles/21371/SQL-Server-Profiler-Step-by-Step

BTW did you try by adding the DataKeyNames="InterventionRecordID" ?
bobbellowsAuthor Commented:
Didn't need to run the profiler. Easwaran nailed it when he saw I didn't have the DataKeyNames. Added DataKeyNames to the properties of the Gridview and on the next trial it made the changes. Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.