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

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
%>

you are welcome

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.