日期:2014-05-18  浏览次数:20447 次

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") %>'/>