Quantcast
Channel: how to call javascript function in html.actionlink in asp.net mvc? - Stack Overflow
Viewing all articles
Browse latest Browse all 7

Answer by Andrew Bullock for how to call javascript function in html.actionlink in asp.net mvc?

$
0
0

you need to use the htmlAttributes anonymous object, like this:

<%= Html.ActionLink("linky", "action", "controller", new { onclick = "someFunction();"}) %>

you could also give it an id an attach to it with jquery/whatever, like this:

<%= Html.ActionLink("linky", "action", "controller", new { id = "myLink" }) %>$('#myLink').click(function() { /* bla */ });

Viewing all articles
Browse latest Browse all 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>