Basically, after a certain time period of inactivity, I was to save/update some data via a routine in my ASP.NET code behind file (essentially mimic a button click right before the user's session time's out).
I'm trying the following and get a javascript error about the object doesn't support this proptery or method..I'm assuming it's for the "myHiddenButton.OnClick();" line of code
*****
HTML
******
</head>
<!-- Start timeout code -->
<body onmousedown = "window_activity()" onkeypress="window_activity()">
<script type="text/javascript">
var timerPROMPT = 0;
var timerCLOSE = 0;
function EndApp(){
//RateDeck.style.display = "none"
//spDeck.style.display = "none"
}
function StopTiming(){
if(timerPROMPT > 0)
window.clearTimeout(timerPROMPT)
//call button
var myHiddenButton = document.getElementById("myHiddenButtonID");
myHiddenButton.OnClick();
//end button call
if (confirm('Due to inactivity, your session is about to time out.')== 1)
{
if(timerCLOSE > 0)
window.clearTimeout(timerCLOSE)
timerPROMPT = window.setTimeout("StopTiming()",5000);
timerCLOSE = window.setTimeout("EndApp()",8000);
}
else
{
EndApp();
}
}
function window_activity() {
if(timerPROMPT > 0)
window.clearTimeout(timerPROMPT)
if(timerCLOSE > 0)
window.clearTimeout(timerCLOSE)
timerPROMPT = window.setTimeout("StopTiming()",5000);
timerCLOSE = window.setTimeout("EndApp()",6000);
}
</script>
<!-- End timout code -->
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="myHiddenButtonID" runat="server" Font-Size="XX-Small" OnClick="myHiddenButtonID_Click"
Text="Hide" /><br />
<br />
<br />
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/top.jpg" />
</div>
</form>
</body>
</html>
*****
Code behind
****
protected void myHiddenButtonID_Click(object sender, EventArgs e)
{
Response.Write("Hidden button click event!");
}
I'm trying the following and get a javascript error about the object doesn't support this proptery or method..I'm assuming it's for the "myHiddenButton.OnClick();" line of code
*****
HTML
******
</head>
<!-- Start timeout code -->
<body onmousedown = "window_activity()" onkeypress="window_activity()">
<script type="text/javascript">
var timerPROMPT = 0;
var timerCLOSE = 0;
function EndApp(){
//RateDeck.style.display = "none"
//spDeck.style.display = "none"
}
function StopTiming(){
if(timerPROMPT > 0)
window.clearTimeout(timerPROMPT)
//call button
var myHiddenButton = document.getElementById("myHiddenButtonID");
myHiddenButton.OnClick();
//end button call
if (confirm('Due to inactivity, your session is about to time out.')== 1)
{
if(timerCLOSE > 0)
window.clearTimeout(timerCLOSE)
timerPROMPT = window.setTimeout("StopTiming()",5000);
timerCLOSE = window.setTimeout("EndApp()",8000);
}
else
{
EndApp();
}
}
function window_activity() {
if(timerPROMPT > 0)
window.clearTimeout(timerPROMPT)
if(timerCLOSE > 0)
window.clearTimeout(timerCLOSE)
timerPROMPT = window.setTimeout("StopTiming()",5000);
timerCLOSE = window.setTimeout("EndApp()",6000);
}
</script>
<!-- End timout code -->
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="myHiddenButtonID" runat="server" Font-Size="XX-Small" OnClick="myHiddenButtonID_Click"
Text="Hide" /><br />
<br />
<br />
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/top.jpg" />
</div>
</form>
</body>
</html>
*****
Code behind
****
protected void myHiddenButtonID_Click(object sender, EventArgs e)
{
Response.Write("Hidden button click event!");
}