• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5610
  • Last Modified:

How Do You Attach an Onclick event to @Html.ActionLink

I need to attach an onclick event to @Html.ActionLink.

Here is my code:
Html.ActionLink(item.Parameters, "ViewResults", new { id = "1122", onclick="javascript:VehicleLoad();return false;" })

I cannot get the onclick event to activate.

Dan
0
danielolorenz
Asked:
danielolorenz
  • 2
1 Solution
 
danielolorenzAuthor Commented:
Corrected code:
Html.ActionLink(item.Parameters, "ViewResults", new { id = "1122", onclick="javascript:VehicleLoad();return false;" })
0
 
Ramkisan JagtapLead DeveloperCommented:
<%= Html.ActionLink("linky", "action", "controller", new { onclick = "someFunction();"}) %>
0
 
danielolorenzAuthor Commented:
Thanks.

Excellent response.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now