Refresh update panel at a certain interval

How can I activate the update of the update panel after a certain period of time.

+3
source share
3 answers

You can use ASP.NET AJAX timer control to trigger an event after a certain period of time. Watch this video from the official ASP.NET website to learn how to use the timer: http://www.asp.net/ajax/videos/how-do-i-use-the-aspnet-ajax-timer-control

+4
source

Use the ASP.Net-Ajax timer to run the UpdatePanel:

<asp:UpdatePanel runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <%--Typical GridView--%>
        <asp:GridView 
            ID="gvOperations" runat="server" 
            GridLines="None" Width="100%"
            AllowSorting="true" DataSourceID="odsOperations"
            OnRowDataBound="GvOperations_RowDataBound">
            <AlternatingRowStyle BackColor="aliceBlue" />
            <HeaderStyle HorizontalAlign="Left" />
        </asp:GridView>
        <%--The Timer that causes the partial postback--%>
        <asp:Timer runat="server" Interval="1500" OnTick="Timer_Tick" />                
    </ContentTemplate>
</asp:UpdatePanel>  

http://mattberseth.com/blog/2007/08/using_the_ajax_timer_control_a.html

. Matt , MSDN.

+2
  • CSS
  • , UpdatePanel
  • Set the timer using Javascript on the click button.

Add a button to your page with the id "btnRefresh".

Set the button as a trigger in the update panel.

Add the following Javascript:

function RefreshUpdatePanel() {
    __doPostBack('<%= btnRefresh.ClientID %>','');  
}

setTimeout('RefreshUpdatePanel()', 10000);

The setTimeout function will call the RefreshUpdatePanel () function every 10 seconds. RefreshUpdatePanel

+1
source

Source: https://habr.com/ru/post/1790981/


All Articles