内容占位符中的updatepanel回发

时间:2014-10-31 09:46:27

标签: javascript c# jquery asp.net .net

我有以下代码:

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <script type="text/javascript">

        document.body.onload = function RefreshPanelEveryMinuteLoop() {
            if (document.getElementById('<%=drptime.ClientID %>').value > 0) {
                __doPostBack('UpdatePanel1', '');
                //var SelectedValue = ddlRefreshGrid.options[ddlRefreshGrid.selectedIndex()].value;

                setTimeout(RefreshPanelEveryMinuteLoop, document.getElementById('<%=drptime.ClientID %>').value);

            }
        }


    </script>

        <div class="dropbox">
            <asp:DropDownList ID="drptime" runat="server">
                <asp:ListItem Value="60000" Text="1 Minute" Selected="True"></asp:ListItem>
                <asp:ListItem Value="180000" Text="3 Minute"></asp:ListItem>
                <asp:ListItem Value="0" Text="Don't Refresh"></asp:ListItem>
            </asp:DropDownList>
        </div>

               <asp:UpdatePanel ID="UpdatePanel1" runat="server" OnLoad="UpdatePanel1_Load">
                <ContentTemplate>
                    <asp:Repeater ID="gvd" runat="server" OnItemCommand="gvd_ItemCommand" OnItemDataBound="gvd_ItemDataBound">
                        <HeaderTemplate>
                      </headertemplate>
                     <ItemTemplate>
                         ....
                         ....//lines of code
                     </ItemTemplate>
                   </asp:Repeater>
                </ContentTemplate>
            </asp:UpdatePanel>

</asp:Content>

现在当我在Windows上调用JavaScript函数时,它将继续刷新页面

在那个javascript中我已经给出了settimeout方法,但它没有工作......

它是持续做_dopostback但我想在我已定义的一分钟之后做_dopostback

那我怎么能这样做呢?

0 个答案:

没有答案