Sunday, June 2, 2024
Homepage · c#
 Popular · Latest · Hot · Upcoming
11
rated 0 times [  15] [ 4]  / answers: 1 / hits: 18174  / 12 Years ago, tue, may 15, 2012, 12:00:00

How do I assign ActionLink to a jQuery button in asp.net MVC page.



<button id=Button1>Click</button>

<%: Html.ActionLink(About, About, Home)%>

<script language=javascript type=text/javascript>
$(function () {

$(#Button1).button().click(function () {
return false;
});
});
</script>

More From » c#

 Answers
46

Based on your comments, you just want to go to the About action in the Home controller on button click, you can do the following and remove the ActionLink:



$(function () {
$(#Button1).click(function () {
location.href = '<%= Url.Action(About, Home) %>';
});
});

[#85564] Monday, May 14, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
peytont

Total Points: 215
Total Questions: 110
Total Answers: 111

Location: Armenia
Member since Sat, Dec 31, 2022
1 Year ago
;