Reputation: 2859
I generate in a foreach loop html links ("test which I add to a pre defined literal.
How can I add a void to the generated html link? I tried with runat server and onclick.. but does not work..
Goal is to add by the onclick a pre defined void from a API.
Thank you.
Upvotes: 0
Views: 188
Reputation: 5944
You either have to create ASP.Net LinkButton
controls for the links in the Init
event of the page, and then you can bind the event handlers to them. (You can put these controls for example into a PlaceHolder
.)
Or add a LinkButton
to the page, check it's Java script written into it as the href attribute, and then put this very same script into your links. Of course, to decide which link of yours has been clicked is a little more tricky, but can be solved.
Upvotes: 1