Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# AsyncPostBackTimeout不更新updatepanel中的数据_C#_Asp.net_.net_Ajax_Visual Studio 2010 - Fatal编程技术网

C# AsyncPostBackTimeout不更新updatepanel中的数据

C# AsyncPostBackTimeout不更新updatepanel中的数据,c#,asp.net,.net,ajax,visual-studio-2010,C#,Asp.net,.net,Ajax,Visual Studio 2010,我想在不回发的情况下更新更新面板中的数据 我在aspx上编写了以下代码: <asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="30"> </asp:ScriptManager> <asp:UpdatePanel ID="upPanel" runat="server"> <ContentTemplate>

我想在不回发的情况下更新更新面板中的数据

我在aspx上编写了以下代码:

<asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="30">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="upPanel" runat="server">
        <ContentTemplate>
            <asp:Label ID="lblCount" runat="server"></asp:Label>
        </ContentTemplate>
    </asp:UpdatePanel>
但它并没有更新标签,即使我给出了

AsyncPostBackTimeout="30"
在脚本管理器中

有什么我弄错了吗

我想在updatepanel内更新标签,而不在特定时间间隔内回发

编辑:

 <asp:UpdatePanel ID="upPanel" runat="server">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
        </Triggers>
        <ContentTemplate>


            <asp:Label ID="lblCount" runat="server"></asp:Label>
        </ContentTemplate>.

    </asp:UpdatePanel>

.

您实际上没有使用异步触发器,要更新面板,您需要声明异步触发器

请检查此url

更详细

要每30秒更新一次页面,可以使用计时器:

<head runat="server">
<title></title>

<script runat="server" type="text/c#">
    protected void Timer1_Tick(object sender, EventArgs e)
    {
        lblCount.Text = "Panel refreshed at: " + DateTime.Now.ToLongTimeString();
    }
</script>

但这是对页面的回发(刷新)。。。我不想每次都刷新页面我只想刷新面板或标签“异步回发事件不是已知元素”此错误存在“异步回发事件不是已知元素”如果在ContentTemplate中放置触发器,则会出现此错误
<head runat="server">
<title></title>

<script runat="server" type="text/c#">
    protected void Timer1_Tick(object sender, EventArgs e)
    {
        lblCount.Text = "Panel refreshed at: " + DateTime.Now.ToLongTimeString();
    }
</script>
<form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="30">
    </asp:ScriptManager>
    <asp:Timer runat="server" id="Timer1" Interval="30000" OnTick="Timer1_Tick"></asp:Timer>
    <asp:UpdatePanel ID="upPanel" runat="server">
         <Triggers>
            <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
        </Triggers>
        <ContentTemplate>
            <asp:Label ID="lblCount" runat="server" Text="Page not refreshed yet."></asp:Label>
        </ContentTemplate>
    </asp:UpdatePanel>
</form>
protected void Timer1_Tick(object sender, EventArgs e)
    {
        Label1.Text = "Panel refreshed at: " +
DateTime.Now.ToLongTimeString();
    }

<form id="form2" runat="server">
    <asp:ScriptManager runat="server" ID="ScriptManager2">
    </asp:ScriptManager>
    <asp:UpdatePanel runat="server" ID="UpdatePanel1">
        <ContentTemplate>
            <asp:Timer runat="server" ID="Timer2" Interval="30000" OnTick="Timer1_Tick"></asp:Timer>
            <asp:Label runat="server" Text="Page not refreshed yet." ID="Label1">
            </asp:Label>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:Label runat="server" Text="Label" ID="Label3"></asp:Label>
</form>