Access javascript's variable from code-behind

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

let say i have a web form with a button on it ... when i click the button, it will pop up one small window to allow me to save a pdf file, everything is done using code behind as below ... however, in javascript, i have set a global variable as a flag to indicate the number of times user click the buttion (let say flagNoOfClick), when user clicks the button once, it will set the flag (flagNoOfClick) to "true" (by using javascript). So, when user tries to click the button again before the first click process is finished, message box will pop up (by using javascript too) ... However, after the web form finishes the code behind as below, i want to set the flagNoOfClick to "false" from code-behind, can i do that from code-behind after "Response.End();" ??
My question is basically, can i access javascript global variable from code-behind and modify the variable's value???
thank you so much ...
============================================================================
Response.Clear()
Response.AddHeader("content-disposition", @"attachment; filename=" + strFilenm + "")
Response.ContentType = "application/pdf";
Response.OutputStream.Write(btDownload,0,btDownload.Length-1);
Response.End();
 
You can do it the other way, this may help. For example, in your JavaScript
block:

newwindow=window.open("<%=sPopupedWindow%>");
</SCRIPT>

and in the codebehind:

Protected sPopupedWindow As String = ""

You can adapt this to your situation.

Machi said:
let say i have a web form with a button on it ... when i click the button,
it will pop up one small window to allow me to save a pdf file, everything
is done using code behind as below ... however, in javascript, i have set a
global variable as a flag to indicate the number of times user click the
buttion (let say flagNoOfClick), when user clicks the button once, it will
set the flag (flagNoOfClick) to "true" (by using javascript). So, when user
tries to click the button again before the first click process is finished,
message box will pop up (by using javascript too) ... However, after the web
form finishes the code behind as below, i want to set the flagNoOfClick to
"false" from code-behind, can i do that from code-behind after
"Response.End();" ???
My question is basically, can i access javascript global variable from
code-behind and modify the variable's value????
 
Back
Top