2012-07-09 86 views
1

我在頁面上的特定部分放置了一個計時器控件,但每當計時器滴答時,我的文本框(我有多個文本框)在另一個部分失去焦點。當計時器正在滴答時,TextBox失去焦點

我該如何解決這個問題?我嘗試將計時器放置在單獨的更新面板中。 在計時器Tick事件代碼

protected void Timer1_Tick(object sender, EventArgs e) 
    { 
     if ((List<AllPostInformation>)Session["AllNewsPostCollection"] != (List<AllPostInformation>)Session["CheckExistData"]) 
     { 
      if ((List<AllPostInformation>)Session["AllNewsPostCollection"] != null) 
      { 


       List<AllPostInformation> o = new List<AllPostInformation>(); 
       o = (List<AllPostInformation>)Session["AllNewsPostCollection"]; 
       rptNews.DataSource = o; 
       rptNews.DataBind(); 
      } 
      Session["CheckExistData"] = Session["AllNewsPostCollection"]; 
     } 
    } 

和ASP頁面

<asp:UpdatePanel runat="server" ID="upTimer"> 
     <Triggers> 
      <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /> 
     </Triggers> 
     <ContentTemplate> 
      <asp:Timer ID="Timer1" runat="server" Interval="5000" /> 
     </ContentTemplate> 
    </asp:UpdatePanel> 
+0

來幫助你,我們需要看代碼 – Wahtever 2012-07-09 12:24:14

回答