Gridview编辑状态无法取消,并且出现”未能加载视图状态。正在向其中加载视图状态的控件树必须与前一请求期间用于保存视图状态的控件树相匹配“错误
HTML code<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="4" OnRowEditing="RowEditing" OnRowDeleting="GridView_RowDeleting" ForeColor="#333333" GridLines="None" OnRowCommand="GridView_RowCommand" OnRowUpdating="OnRowUpdating" OnDataBound = "GridView_DataBind" OnRowDataBound = "GridView_RowDataBound" Width="760px" HorizontalAlign="Center" onrowcancelingedit="GridView1_RowCancelingEdit" onpageindexchanging="GridView1_PageIndexChanging" EnableViewState="True"> <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <RowStyle BackColor="#FFFBD6" ForeColor="#333333" HorizontalAlign="Center" /> <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" /> <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" /> <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <AlternatingRowStyle BackColor="White" /> <Columns> <asp:TemplateField HeaderText="审核状态" SortExpression="F_Audit"> <ItemTemplate> <asp:Label ID="lblaudit" runat="server" Text='<%# Eval("F_Audit").ToString() == "1"?"已审核":"未审核"%>' Width="120px" /> </ItemTemplate> <EditItemTemplate> <asp:RadioButtonList ID="AuditRBL" runat="server" RepeatDirection="Horizontal" Width="120px" > <asp:ListItem Value="0" Text="未通过"></asp:ListItem> <asp:ListItem Value="1" Text="已通过"></asp:ListItem> </asp:RadioButtonList> <asp:HiddenField ID="HF1" runat="server" Value='<%# Eval("F_Audit") %>'/> </EditItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="级别"> <ItemTemplate> <asp:Label ID="lbllevel" runat="server" Text='<%# Eval("F_Level") %>' Width="100px" ></asp:Label> </ItemTemplate> <EditItemTemplate> <asp:RadioButtonList ID="LevelRBL" runat="server" RepeatDirection="Horizontal" Width="100px" > <asp:ListItem Value="0" Text="普通会员"></asp:ListItem> <asp:ListItem Value="1" Text="ViP"></asp:ListItem> </asp:RadioButtonList> <asp:HiddenField ID="HF2" runat="server" Value='<%# Eval("F_Level") %>'/> </EditItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="查询详细资料"> <ItemTemplate> <asp:LinkButton ID="LBInfo" runat="server" CommandName="info" CommandArgument='<%# Eval("Member_ID") %>' Text="详细资料" Width="80px" /> </ItemTemplate> <ControlStyle Width="80px" /> </asp:TemplateField> <asp:TemplateField HeaderText="修改"> <ItemTemplate> <asp:Button ID="Button3" runat="server" Text="修改" CommandName="edit" Width="40px" /> </ItemTemplate> <EditItemTemplate> <asp:Button ID="Button1" CommandName="update" runat="server" Text="更新" CommandArgument="<%# ((GridViewRow)Container).RowIndex %>" OnClientClick="return confirm('您确定要更新现有数据吗?')" Width="35px" /> <asp:Button ID="Button2" runat="server" CommandName="Cancel" Text="取消" Width="35px" /> </EditItemTemplate> <ItemStyle Width="80" /> </asp:TemplateField> <asp:TemplateField HeaderText="删除"> <ItemTemplate> <asp:LinkButton ID="LinkButton1" runat="server" CommandName="delete" CommandArgument='<%#Eval("Member_ID") %>' Text="删除" OnClientClick="return confirm('您确定要删除此项数据吗?')"></asp:LinkButton> </ItemTemplate> </asp:TemplateField> </Columns>