如何使用javascript仅为asp.net中的中继器创建自动刷新数据?

如何使用javascript仅为asp.net中的中继器创建自动刷新数据?,javascript,asp.net,Javascript,Asp.net,我想在收件箱中做一个邮件系统,只在中继器中自动刷新数据。怎么做 <asp:Repeater ID="Repeater1" runat="server" DataSourceID="dsInbox"> <ItemTemplate> <tr id="trInbox" class="normal" style='cursor:pointer; font-weight:<%# StyleBold(Convert.ToBoolean

我想在收件箱中做一个邮件系统,只在中继器中自动刷新数据。怎么做

 <asp:Repeater ID="Repeater1" runat="server" DataSourceID="dsInbox">
        <ItemTemplate>
          <tr id="trInbox" class="normal" style='cursor:pointer; font-weight:<%# StyleBold(Convert.ToBoolean(Eval("inbRead")) ) %>' onclick='selectedRow(this,<%# Eval("INBID") %>)'   onMouseOver="if(this.className!='selected') this.style.backgroundColor='#E2E1F4';" onMouseOut="if(this.className!='selected') this.style.backgroundColor='#FFFFFF'"> 
            <td width="370px" height="25px"><div align="left" class="style95">&nbsp;<%# DisplaySubject(Eval("inbSubject").ToString(), Eval("inbMsg").ToString())%></div></td> 
            <td width="80px" height="25px"><div align="left" class="style95">&nbsp;<%# Eval("inbCreatedAt","{0:MM-dd-yyyy}") %></div></td> 
            <td width="94px" height="25px"><div align="left" class="style95">&nbsp;<%# Eval("inbCreatedAt","{0:hh:mm:ss tt}") %></div></td> 
          </tr>   
        </ItemTemplate>
        </asp:Repeater>

您可以在
更新面板中使用ASP.NET的计时器控件
与中继器一起使用,计时器调用的每个勾号事件都可以重新绑定中继器


以下是我建议的ASPX标记示例:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <asp:Timer runat="server" ID="Timer1" Interval="30000" OnTick="Timer1_Tick" />

        <asp:Repeater runat="server" ID="Repeater1">
                // Your Repeater Template    
        </asp:Repeater>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
    </Triggers>
</asp:UpdatePanel>
protected void Timer1_Tick(object sender, EventArgs e)
{
    Repeater1.Datasource = // Whatever your datasource is
    Repeater1.DataBind();
}