2012-03-15 9 views
0

私は、受信機のメールシステムを、データのリピーターだけで自動的に最新の状態に更新したいと思っています。あなたは、一緒にあなたのリピータでUpdatePanel内部でタイマーが起動することを、すべてのTickイベントをASP.NETのタイマコントロールを使用することができますasp.netのリピーター専用の自動リフレッシュデータを作成するにはjavascriptを使用する方法?

<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> 

答えて

0

、あなたのリピーターを再バインドすることができます。ここ


私の提案のサンプル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(); 
} 
+0

それは私に仕事thankz – user983738

関連する問題