开发者

Refresh MuliView's view every 5 seconds

in the clientside pageLoad() function im trying to get the multiview active index and postback to my updatepanel1 after 5 seconds only if active index is 2

following code:

<script type="text/javascript" language="Java开发者_Go百科Script">
    function pageLoad() {
       if (document.getElementById('MultiViewManage').getAttribute("ActiveViewIndex") == 2) {
          window.setTimeout("__doPostBack('UpdatePanel1','')",5000);
       }
   } 
</script>

im getting null exeption or some kind of error what am i doing wrong? thanks


To auto-refresh your update panel after 5 seconds if user is on MultiView's ActiveViewIndex=2, use an ASP.Net Timer in your UpdatePanel that fires an asynchronous postback every 5 seconds. I would embed the content of the view that should be refreshed in a separate UpdatePanel.

<asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="5000"></asp:Timer>
<asp:UpdatePanel ID="UpdPanelRefresh" UpdateMode="Conditional" runat="server">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
            </Triggers>
            <ContentTemplate>
.....

Then refresh the content of your UpdatePanel in Timer_Tick event-handler in codebehind.

I would embed all views in separate UpdatePanels beside the outer UpdatePanel. If you switch the view you have to trigger the outer UpdatePanel. But the timer-tick will trigger the inner UpdatePanel that belongs to view with ActiveViewIndex 2

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜