Could you tell me why I get the error "GridView" GridView1? RowUpdating which was not processed? "

I managed to solve the initial problem of the inability to insert records sequentially, but a new error message appears.

Now I get The GridView 'GridView1' fired event RowUpdating which wasn't handled.

This error occurs when I click the Refresh button to update the recording line.

First click the "Edit" button. This provides the Update / Cancel buttons.

When I click the Refresh button, I get the above error.

My first assumption was that gridview is necessary for RowUpdating, but after adding (see the markup code), still getting the same error.

This is a little disappointing.

Here is the code.

 Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs) Dim dd As DropDownList = DirectCast(GridView1.Rows(e.RowIndex).FindControl("ddlstatus"), DropDownList) e.NewValues("status") = dd.SelectedItem.Text End Sub 

Markup:

  <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="False" DataKeyNames="reqnum" AllowPaging="True" CellPadding="4" ForeColor="#333333" GridLines="None" Visible="True" OnRowDataBound="gvRowDataBound" OnRowEditing="GridView1_RowEditing" onrowupdating="GridView1_RowUpdating" EnableViewState="False" AutoGenerateDeleteButton="True" AutoGenerateEditButton="True"> <RowStyle BackColor="#F7F6F3" ForeColor="#333333" /> <Columns> <asp:BoundField DataField="rownum" HeaderText="rownum" InsertVisible="False" ReadOnly="True" SortExpression="rownum" /> <asp:BoundField DataField="reqnum" HeaderText="reqnum" SortExpression="reqnum" /> <asp:BoundField DataField="reqrecdate" HeaderText="reqrecdate" SortExpression="reqrecdate" /> <asp:BoundField DataField="reqrecfrom" HeaderText="reqrecfrom" SortExpression="reqrecfrom" /> <asp:BoundField DataField="skillsets" HeaderText="skillsets" SortExpression="skillsets" /> <asp:BoundField DataField="application" HeaderText="application" SortExpression="application" /> <asp:BoundField DataField="hoursperweek" HeaderText="hoursperweek" SortExpression="hoursperweek" /> <asp:BoundField DataField="fromdate" HeaderText="fromdate" SortExpression="fromdate" /> <asp:BoundField DataField="todate" HeaderText="todate" SortExpression="todate" /> <%-- <asp:BoundField DataField="status" HeaderText="status" SortExpression="status" />--%> <asp:TemplateField HeaderText="status"> <EditItemTemplate> <asp:DropDownList id="ddlstatus" CssClass="dropdown" DataSourceID="DSforDDL" runat="server"> <asp:ListItem Text="none" Value=""></asp:ListItem> <asp:ListItem>Not Started</asp:ListItem> <asp:ListItem>Pending</asp:ListItem> <asp:ListItem>Completed</asp:ListItem> </asp:DropDownList> </EditItemTemplate> <ItemTemplate> <asp:Label ID="lblstatus" runat="server" Text='<% #Bind("status") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="statusupdate" HeaderText="statusupdate" SortExpression="statusupdate" /> <asp:BoundField DataField="statusupby" HeaderText="statusupby" SortExpression="statusupby" /> </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:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT Distinct [rownum],[reqnum], [reqrecdate], [reqrecfrom], [skillsets], [application], [hoursperweek], [fromdate], [todate], [status], [statusupdate], [statusupby] FROM [Term] ORDER BY [reqnum]" UpdateCommand="INSERT INTO Term(reum, reqrecdate, reqrecfrom, skillsets, application, hoursperweek, fromdate, todate, status, statusupby, statusupdate) VALUES (@reum,@reqrecdatelbltxt, @reqrecfromlbltxt, @skillsets, @application, @hoursperweek,@fromdate,@todate, @status, @lognametxt, @logdatetxt)" <DeleteParameters> <asp:Parameter Name="rownum" Type="Int32" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="reqnum" Type="String" /> <asp:Parameter DbType="DateTime" Name="reqrecdate" /> <asp:Parameter Name="reqrecfrom" Type="String" /> <asp:Parameter Name="skillsets" Type="String" /> <asp:Parameter Name="application" Type="String" /> <asp:Parameter Name="hoursperweek" Type="Int32" /> <asp:Parameter DbType="DateTime" Name="fromdate" /> <asp:Parameter DbType="DateTime" Name="todate" /> <asp:Parameter Name="status" Type="String" /> <asp:Parameter DbType="DateTime" Name="statusupdate" /> <asp:Parameter Name="statusupby" Type="String" /> <asp:Parameter Name="rownum" Type="Int32" /> </UpdateParameters> </asp:SqlDataSource> 

Many thanks for your help.

+4
source share
1 answer

GridView tracks handlers to make sure something has been added to deal with the update intentionally.

If you don’t manually enter “AddHandler”, something else in the code, I don’t see a cluster of handles for your event method that would intercept the event that was generated.

0
source

Source: https://habr.com/ru/post/1479739/


All Articles