0
Reply

Access Value of PUBLIC variable when response.write and FLUSH is used.

Sunjib Mohnaty

Sunjib Mohnaty

Jul 10 2009 2:11 AM
2.9k
Hi,

I have an Application which Sends EMAILs in block, say 500 Emails in one GO. User has the choise to STOP the process in between.

The STOP button is printed to client uisng response.write. In click of this Image / Button the Stop_Process js method is called.

I an not being able to Access the code behind Global/public/session variable / hidden filed values from this js method please help.

CODE for your Reference
====================== CODE BEHIND
      public  int TotalAttemTEmails  = 0;
      public  int totalDuplicateMail = 0;  
      public  int totalSucessMail    = 0;
      
protected void Page_Load(object sender, EventArgs e)
 {           
            if (!IsPostBack)
            {
                if (Request.QueryString["IsStop"] != null)
                {
                    if (Request.QueryString["IsStop"].ToString() == "true")
                        StopProcessing();
                }
       }
}
 private void StopProcessing()
 {
          WANT to retain the Processed values of the public variables and
          DO required processing using those.
}


=============== JS code
<HTML>
<HEAD>
<TITLE>Execute Campaign</TITLE>
<style type="text/css"> body {FONT-SIZE: 8pt;
    FONT-FAMILY: Arial,Helvetica,sans-serif;} </style>
<script language="JavaScript">
      function fn_StopProcess()
     {
       var retSPVal = confirm("Are you sure want to stop current  process?")       
        if (retSPVal) {
            if (window.opener)
            {
                //alert(document.getElementById("Hdnrunid").value);
                alert(document.getElementById("<%=Hdnrunid.ClientID%>").value);
                window.location = window.parent.location.href + "&IsStop=true"; 
            }
            //window.close();
        }
        //return;
    }
   
</script>
</HEAD>
<BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="table-layout: fixed; padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0px;">
<table width=100% Border=0 bgcolor="eeeeee" cellpadding="0" cellspacing="0" bordercolor="silver" ID="Table1">
    <tr bgcolor="Cornsilk" height="25">
     <td valign="middle" width=1><img src="images/dividersmall.gif" border=0></td>
     <td valign="middle" width="18"><a href="javascript:void(0)" class="WhiteLink" oncontextmenu="nocontextmenu()" onclick="javascript:fn_StopProcess()"> <img src="images/stop.gif" border=0 title="Stop Execution"></a></td>
     <td valign="middle" width=1><img src="images/dividersmall.gif" border=0></td>
     <td align=right>
        <B><font size="2" face="Arial, Helvetica, sans-serif" color="#2B3A86">Execution Details&nbsp;&nbsp;&nbsp;</font></B>
     </td>
    </tr>
    <tr>
    <td colspan="4" height="1" bgcolor="#000000"></td>
    </tr>
</table>
</body>
</html>