ASP.NET 通过计时器更新数据列表不起作用

ASP.NET Update datalist by timer is not working

我有一个 updatepanel,里面有一个 label 和一个 datalist,如下所示

<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">     
  <ContentTemplate>    
      <asp:Timer ID="Timer1" runat="server" Interval="2000" Enabled="True" ontick="Timer1_Tick"></asp:Timer>
      Tick <asp:Label ID="LabelTick" runat="server" Text=""></asp:Label>
      <asp:DataList ID="dl1" runat="server" DataSourceID="SqlDataSource1" RepeatColumns = "4" CellSpacing = "3" RepeatLayout = "Table">
         <ItemTemplate>
            ...
         </ItemTemplate>
      </asp:DataList>
      <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnectionString %>" SelectCommand="SELECT ..."></asp:SqlDataSource> 
   </ContentTemplate>
</asp:UpdatePanel>

在代码隐藏中,我在每次更新后更新数据绑定:

Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick

    dl1.DataSourceID = SqlDataSource1.ID
    dl1.DataBind()

    LabelTick.Text = DateTime.Now.ToString()

End Sub

label每2秒正确更新一次,这意味着计时器正确运行。但是 DataList 没有刷新,它只在页面加载后刷新一次。 为什么?

滴答调用结束时:

 UpdatePanel1.Update()