?
Solved

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

Posted on 2014-09-05
3
Medium Priority
?
4,633 Views
Last Modified: 2014-09-11
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
Comment
Question by:danielolorenz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:danielolorenz
ID: 40306414
Corrected code:
Html.ActionLink(item.Parameters, "ViewResults", new { id = "1122", onclick="javascript:VehicleLoad();return false;" })
0
 
LVL 12

Accepted Solution

by:
Ramkisan Jagtap earned 2000 total points
ID: 40307163
<%= Html.ActionLink("linky", "action", "controller", new { onclick = "someFunction();"}) %>
0
 

Author Closing Comment

by:danielolorenz
ID: 40317640
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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question