这是控制结构
ContentPlaceHolder
--> 向导
--> 面板
我正在使用 setTimeout 在 x 分钟后显示面板。
如何获取面板的 ClientID?
所需的 javascript 行类似于:
setTimeout(displayExtendSession('<%= ExtendSession.ClientID %>', 600000);
aspx
<asp:Content ID="Content1" runat="server" ...>
<asp:Wizard ID="wizard1" runat="server" ... >
<asp:Panel ID="ExtendSession" runat="server">
<asp:Label ID="ExtendSessionLifePrompt" runat="server" Text="Your session is going to expire in 1 minute. Would you like to extend your Session?"></asp:Label>
<asp:Button ID="ExtendSessionLife" runat="server" Text="Yes" />
<input type="button" id="CancelExtendSessionLife" value="No" onclick="HideExtendSession('<%= ExtendSession.ClientID %>'); return false;" />
</asp:Panel>
</asp:Wizard>
</asp:Content>
javascript
function HideExtendSession(msgBox) {
if (msgBox)
document.getElementById(msgBox).style.display = "none";
}
function DisplayExtendSession(msgBox) {
if (msgBox)
document.getElementById(msgBox).style.display = "block";
}
setTimeout(DisplayExtendSession('<%= ExtendSession.ClientID %>', 600000);
setTimeout(HideExtendSession('<%= ExtendSession.ClientID %>', 720000);