# Call Asp Procedure from Hyperlink

**URL:** <https://forum.kirupa.com/t/call-asp-procedure-from-hyperlink/42134>\
**Category:** programming\
**Created:** [February 5, 2004, 3:39pm UTC](https://forum.kirupa.com/t/call-asp-procedure-from-hyperlink/42134 "2004-02-05T15:39:47Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![boristheblade](https://avatars.discourse-cdn.com/v4/letter/b/848f3c/32.png) [@boristheblade](https://forum.kirupa.com/u/boristheblade)\
**Post date:** [February 5, 2004, 3:39pm UTC](https://forum.kirupa.com/t/call-asp-procedure-from-hyperlink/42134/1 "2004-02-05T15:39:47Z")

</div>

Is it possible to call an asp Procedure or Function from a hyperlink? I am trying to call a procedure when I click on a text link.

i.e.

…a href=\<%call MyProcedure(arg)%\> click me \</…

That example doesnt work because it just writes the contents of MyProcedure in to the link.

THANKS FOR ANY HELP!!!:to:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2004, 3:50pm UTC](https://forum.kirupa.com/t/call-asp-procedure-from-hyperlink/42134/2 "2004-02-05T15:50:20Z")

</div>

no, there’s no way I know of to do that…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2004, 3:51pm UTC](https://forum.kirupa.com/t/call-asp-procedure-from-hyperlink/42134/3 "2004-02-05T15:51:25Z")

</div>

agreed. There is no way to do that.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2004, 3:55pm UTC](https://forum.kirupa.com/t/call-asp-procedure-from-hyperlink/42134/4 "2004-02-05T15:55:11Z")

</div>

Alternatives:

set a special GET var in the link(like myProc=1) and then if the GET var is 1, then call myProc wherever you want.

or

Use javascript(harder, but user doesn’t need to wait for another page to load before they can read some text)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2004, 6:19pm UTC](https://forum.kirupa.com/t/call-asp-procedure-from-hyperlink/42134/5 "2004-02-05T18:19:49Z")

</div>

What does the procedure do? VBScript procedures in ASP run on the server, so at best the procedure can return some text to the browser. Do what njs12345 is saying, make the link:  
\<a href=“[http://myserver.com/PageWithProcedure.asp?arg=somevalue](http://myserver.com/PageWithProcedure.asp?arg=somevalue)”\>Click Me\</a\>

Then in the ASP page do:

```auto

If Len(Request.QueryString("arg")) > 0 Then
   Call MyProcedure(Request.QueryString("arg))
End If

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2004, 11:16pm UTC](https://forum.kirupa.com/t/call-asp-procedure-from-hyperlink/42134/6 "2004-02-05T23:16:27Z")

</div>

Thanks for the replies.

The procedure writes a table filled with information from a recordset. I know that there are other ways to do record navigation, like using querystrings and such, but wanted to try this.

Basically here is the layout I was trying to achieve…

Open recordset  
fill array with recordset rows  
close record set

Sub FillTable(direction)  
if direction = 1  
Display next record using array  
else  
Display previous record using array  
End Sub

Then at the bottom I would have the links saying

Prev and Next that would call the procedure to fill the table without having to load a new page.

Sorry if this is unclear.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2004, 11:20pm UTC](https://forum.kirupa.com/t/call-asp-procedure-from-hyperlink/42134/7 "2004-02-05T23:20:37Z")

</div>

So Sub FillTables is VBScript running on the client side? Because if it is not running on the client side, then you would still have to reload the page anyway to run that procedure. And, if it is running on the client side it will only work with IE.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2004, 12:57am UTC](https://forum.kirupa.com/t/call-asp-procedure-from-hyperlink/42134/8 "2004-02-06T00:57:57Z")

</div>

Ok, I gotcha now. I’m kinda new to server side, but now I understand why my way won’t work.

Thanks!!🍺
