title: Call ASP function from button in table
body: <p>I create a dynamic table in asp classic for each row there is a button, i need that this button will active some function..</p>
  
  <p>In some reason the button dosent react..</p>
  
  <p>The source code: </p>
  
  <pre><code> &lt;%
  set con = Server.CreateObject("ADODB.Connection")
  con.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &amp; Server.MapPath("WebData/DB.mdb") &amp; ";"
  set rs = con.Execute("Select ProdID,ProductName,BrandName,CategoryName,Description,Price FROM Products P,Brands B,Categories C WHERE P.mode = true AND InStock=true AND P.CatID =C.CatID AND SupID = BrandID")
  Dim filePath  
  Dim Id
  Dim nNumOfItems 
  Dim NumStr
   nNumOfItems = 0
  Do Until rs.EOF
  nNumOfItems = nNumOfItems + 1
  Id = rs.Fields("ProdID").Value
  Response.Write "&lt;tr&gt;"
  Response.Write "&lt;td&gt;"
  Response.Write rs.Fields("ProductName").Value
  Response.Write "&lt;/td&gt;"
  Response.Write "&lt;td&gt;"
  Response.Write "&lt;button  name = ' DeleteProduct '  value ='DeleteProduct' class = 'button' onClick='DeleteProduct ('Id')'&gt;"
  Response.Write "Delete Product"
  Response.Write "&lt;/button&gt;"
  Response.Write "&lt;/td&gt;"
  Response.Write "&lt;/tr&gt;"
  rs.MoveNext
       Loop
  
      rs.Close
    Set rs = Nothing  
     con.Close
         Set con = Nothing
     %&gt;
  
     &lt;%
    Function DeleteProduct(Id)
    set con = Server.CreateObject("ADODB.Connection")
    con.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &amp; Server.MapPath("WebData/DB.mdb") &amp; ";"
    set rs= "Update products SET mode = false WHERE ProdId= "&amp;cint(Id)&amp;""
    response.write("&lt;script language=""javascript""&gt;alert('Product has been removed!');      &lt;/script&gt;") 
  
    End Function
    %&gt;
  </code></pre>
  
  <p>Thanks for help!</p>