I create a dynamic table in asp classic for each row there is a button, i need that this button will active some function..
In some reason the button dosent react..
The source code:
<%
set con = Server.CreateObject("ADODB.Connection")
con.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("WebData/DB.mdb") & ";"
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 "<tr>"
Response.Write "<td>"
Response.Write rs.Fields("ProductName").Value
Response.Write "</td>"
Response.Write "<td>"
Response.Write "<button name = ' DeleteProduct ' value ='DeleteProduct' class = 'button' onClick='DeleteProduct ('Id')'>"
Response.Write "Delete Product"
Response.Write "</button>"
Response.Write "</td>"
Response.Write "</tr>"
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
con.Close
Set con = Nothing
%>
<%
Function DeleteProduct(Id)
set con = Server.CreateObject("ADODB.Connection")
con.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("WebData/DB.mdb") & ";"
set rs= "Update products SET mode = false WHERE ProdId= "&cint(Id)&""
response.write("<script language=""javascript"">alert('Product has been removed!'); </script>")
End Function
%>
Thanks for help!