0

I want to call asp function in anchor link click. Is it possible to call server side function from client side action.

I want to delete file from server when user clicks the hyperlink...

Any help please...


Regards
venkat

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by hielo
0

you cannot call the function directly. You need to call a server-side script an pass arguments to the script. Then process those arguments and do whatever you need to do depending on the values of said arguments - ex:

<a href='fileRemover.asp?id=3'>Test.txt</a>

then in fileRemover.asp you check a "lookup table" of valid file names:

<%
Dim theFiles,id
'provide list of files
theFiles = "file0.txt;file2.txt;file3.txt,file4.txt"
theFiles = split( theFiles,";")

'id of clicked link
id = Request("id")
If IsNumeric(id) Then
  If NOT IsEmpty( theFiles(id) ) Then
    Response.Write("Deleting File" & theFiles(id) )

   'if you have a function  that accepts the name 
   'of the file to  be deleted then just call it - ex
  deleteFile( theFiles(id) )
  End If
End If
%>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.