其他页面上的控件事件未被触发并出错

时间:2013-11-19 06:56:32

标签: javascript asp.net .net eventvalidation

这是我如何在div中加载aspx页面

<script type="text/javascript">
    $(function () {

        setInterval(function () {
            $('#div1').load('frmChatRequest.aspx', function () {

            });
        }, 10000);
    });

</script>

但是我遇到了一个问题,就是我有网格视图控件,比如按钮字段,他们的事件没有触发,而且它发出了这个错误"The state information is invalid for this page and might be corrupted."我该怎么办? 这是错误enter image description here

这是frmChatRequest.aspx页面

<%@ Page EnableEventValidation="false" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="frmChatRequest.aspx.cs"   Inherits="Chat_frmChatRequest" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">



</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div id="divConversation" 
        style=" width: 101%; height:174px; overflow:auto; overflow-x:hidden">
    <asp:GridView S ID="gdvChatRequestRoom" style="background-color:ALICEBLUE;"
        runat="server" AutoGenerateColumns="false"  Width="358px" Height="57px" GridLines="Horizontal"
        BorderStyle="None" BorderColor="Black" 
        OnRowCommand="gdvChatRequestRoom_RowCommand"  >
        <Columns>
            <asp:TemplateField  ItemStyle-HorizontalAlign="Center">
                <ItemTemplate>

                    <asp:HiddenField ID="hdnAddPeople" Value='<%#Eval("Q116001") %>' runat="server" />
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Center"></ItemStyle>
            </asp:TemplateField>
            <asp:BoundField HeaderText="Chat Title" DataField="Q116003" ItemStyle-HorizontalAlign="Left">
                <ItemStyle HorizontalAlign="Center"></ItemStyle>
            </asp:BoundField>
            <asp:BoundField HeaderText="Request By "  DataField="LOG2002" ItemStyle-HorizontalAlign="Left">
                <ItemStyle HorizontalAlign="Center"></ItemStyle>
            </asp:BoundField>
            <asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Action">
                <ItemTemplate>
                    <asp:Button ID="btnAccept" CausesValidation="false" runat="server" Text="Accept" CommandName="Accept" CommandArgument='<%# Eval("Q116002") %>'>
                    </asp:Button>
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Center"></ItemStyle>
            </asp:TemplateField>

                 <asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="" >
                <ItemTemplate>
                 <asp:Button ID="btnReject" CausesValidation="false" runat="server" Text="Reject" CommandName="Reject" CommandArgument='<%# Eval("Q116002") %>'>
                </asp:Button>
                </ItemTemplate>

                <ItemStyle HorizontalAlign="Center"></ItemStyle>
            </asp:TemplateField>
        </Columns>
        <HeaderStyle BorderStyle="None" />
    </asp:GridView>
    </div>


    <div>
     <marquee runat="server" id="myMarqueeChatRequest" direction=left scrollamount="11" scrolldelay="200" style="color:Red;background-color:ALICEBLUE;"></marquee>

  </div>
</asp:Content>

1 个答案:

答案 0 :(得分:2)

如果文件存在,你可以检查网址的路径吗?你想要10000毫秒执行frmChatRequest.aspx文件吗?如果不使用setTimeout而不是。

就像这样

<script type="text/javascript">
    $(function () {

        setTimeout(function () {
            $('#div1').load('frmChatRequest.aspx', function () {

            });
        }, 10000);
    });

</script>