Solved

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

Posted on 2014-09-05
3
3,646 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
  • 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 500 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Lazy load not working with masonry js 1 18
is this a cms? 8 60
How can i get the length? 7 32
PHP Form Calculate Total Price 10 42
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…

776 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