以前用jquery的ajax实现。现在为了加快开发速度好维护用了用asp.net自带的定时刷新功能。发现没有合适的解决方法。这来个正解。有愿意联系我的qq810039018.希望帮到大家。我不是高手。用.net开发5年。
ou can use ASP.NET's timer control inside an UpdatePanel together with your repeater, every tick event that the timer invokes, you can rebind your repeater.
here is a sample ASPX markup of my suggestion:
<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>
and for your code behind:
protected void Timer1_Tick(object sender, EventArgs e)
{
Repeater1.Datasource = // Whatever your datasource is
Repeater1.DataBind();
}