Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call a procedure from a link

Status
Not open for further replies.

JennB

Programmer
Feb 3, 2002
29
CA
Hi,
I am calling a list of articles from a sql server database and putting them in a table. I have then linked each of the articles to allow them to be downloaded. What I need to figure out is how to also call a sub procedure when the user clicks on the link. My client would like to keep track of which articles are being downloaded by whom. The sub procedure sends this information to the database. I have tried using onclick but nothing happens. Thanks for your help

So far my code looks like this:
while ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))

%>
<tr>
<td align=&quot;default&quot; width=&quot;61%&quot; height=&quot;24&quot;>
<a href = &quot;<%=(article.Fields.Item(&quot;filename&quot;).Value)%>&quot;>
<%=(article.Fields.Item(&quot;Title&quot;).Value)%> </a>
</td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
 
You can call client side code with a link:
<a href=&quot;#&quot; onClick=&quot;yourproc()&quot;>Click Here</a>

However, this will not work for server side scripts. What I would suggest doing is to build a form with hidden inputs as any info, then use a button or link to submit this and do any desired processing and output on the next page. you could open your new page in the same window or in a new one, thus keeping the original &quot;source&quot; page present.

If you need any further help, just ask.
 
<a href = &quot;<%=(article.Fields.Item(&quot;filename&quot;).Value)%>&quot;>
This line suggests that the filename is in the same directory as the asp file.

If the article.Fields.Item(&quot;filename&quot;).Value is empty the result will be:
<a href=&quot;&quot;>sometext</a>
Clicking on the href will result in the user trying to open the directory where the asp page is located. Probebly the default.asp in this directory is opened (depending on IIS settings).

I take it the aricle is a recordset?
Why the statement:
while ... Recordset1.EOF
and ....Recordset1.MoveNext

It seems that you are using an Recordset1 for your loop but a recordset called article for the data???
 
Make each link go to a second page.
Include the article you want to download in the link QueryString.
In the second page strip off the QS articleID and tell the database about it.
Then (haven't tested this - or thought it thru for that matter - too late at night) redirect to the file you're after. codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
<insert witticism here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top