2012-01-02 41 views
1

我有一個UpdatePanel和計時器。上傳面板和定時器完全刷新頁面:(

我想刷新只是我的UpdatePanel但是當我把一個計時器裏面的UpdatePanel它不工作,當我把它超出了我的頁面它

我應該怎麼做

<asp:UpdatePanel runat="server" ID="updLastAouction" UpdateMode="Conditional"> 
       <ContentTemplate> 


     مزایده شماره : <asp:Label runat="server" ID="lbAuctionID"></asp:Label> 

     <br/> 
     <div style="margin-bottom: 10px;"> 
     آخرین قیمت پیشنهادی : 
     </div> 
      <asp:Label runat="server" ID="lbLastOrderPrice"></asp:Label> 

     <div class="lastBidder"> 
      <div style="margin-bottom: 10px;"> 
      آخرین پیشنهاد دهنده 
      </div> 
      <asp:Label runat="server" ID="lbLastBidder">ندارد</asp:Label> 
     </div> 
     <div class="lastBidder" style="margin-top:5px;margin-bottom: 5px;"> 
      <div class="font"> 
      زمان باقی مانده</div> 

      <asp:Label runat="server" ID="lbLeftTime" Text='<%#DateTime.Now.ToLongTimeString() %>'></asp:Label> 
      <br/> 
     </div> 
     <asp:Button runat="server" ID="btnLastAouction" Text="برای شرکت عضو شوید" 
         onclick="btnLastAouction_Click"/> 
        </ContentTemplate> 
      </asp:UpdatePanel><asp:Timer ID="timerLastAouction" runat="server" Interval="1000" 
         OnTick="timerLastAouction_Tick" /> 
+0

爲什麼它必須在更新面板內? – Oded 2012-01-02 23:34:22

+0

,因爲我想更新只是更新面板不頁 – 2012-01-02 23:47:07

回答

3

如果計時器沒有內部UpdatePanel它會導致完全回傳則可以添加AsyncPostbackTiggerUpdatePanel:?

<Triggers> 
    <asp:AsyncPostBackTrigger ControlID="timerLastAouction" EventName="Tick" /> 
</Triggers> 

或者您可以將定時器控件包裝在單獨的UpdatePanel中以避免整頁回發。

<asp:UpdatePanel runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false" 
    ID="upTimer"> 
    <ContentTemplate> 
     <asp:Timer ID="timerLastAouction" runat="server" Interval="1000" OnTick="timerLastAouction_Tick"> 
     </asp:Timer> 
    </ContentTemplate> 
</asp:UpdatePanel> 
+0

沒有不工作:(我需要這個,這是非常重要的這個項目 – 2012-01-02 23:45:46

+0

這是真的,但我的錯誤是在代碼隱藏謝謝分配兄弟 – 2012-01-03 01:03:11