title: how to call an ASP.NET c# method using javascript
body: <p>Does anyone know how to call a server-side c# method using javascript? What i need to do is to stop imports if Cancel is chosen or to continue importing if ok is chosen. I am using visual studio 2010 and c# as my programming lanaguage</p>
  
  <p>This is my code:</p>
  
  <pre><code>private void AlertWithConfirmation()            
  {                 
      Response.Write(
          "&lt;script type=\"text/javascript\"&gt;" +     
              "if (window.confirm('Import is currently in progress. Do you want to continue with importation? If yes choose OK, If no choose CANCEL')) {" +     
                  "window.alert('Imports have been cancelled!');" +     
              "} else {" +   
                  "window.alert('Imports are still in progress');" +     
              "}" +      
          "&lt;/script&gt;");   
  }
  </code></pre>