Skip to content
Loading
html.actionlink to run jquery on click
 The above code is working fine, why do you need Action and controller when you could paas null.Paste the above code in MVC view and please test.
  • No Idea on how to have the html.actionlink to go to my jquery function.
    this is not working
    @html.actionlink("link text","#", null, new{onclick="myfunction"})... whatever I have tried from the internet would ether go to the page controller and action method or would not trigger the jquery function.
  • One more thing with the html.actionlink is I have to provide an action and a controller, I dunno how to make it work without providing an action and a controller.
  • Thank you all for you time and your help, Mr Ahmed I like you idea but this code doesn't work may be you omit something, I am posting it 
    @Html.ActionLink("Delete", "DeleteCategory", "Admin", new { item.CategoryID }, new {data_toggle = "modal", data_target = "#Delete", id="deleteActionLink", data_parameter="" })
     
    Thank you 
  • Sachin Singh
    This is what i would have done if i were in your place , really i don't think much
    1. @Html.ActionLink(item.Id.Tostring(), nullnullnew { @class = "select" })  
    2.   
    3. $("body").on("click"".select", function () {  
    4.   
    5. $("#YourModel").show();  

     
  • Jignesh Kumar
    Hi Alex,
     
    Please use this link,
    https://www.c-sharpcorner.com/UploadFile/092589/implementing-modal-pop-up-in-mvc-application/ 
    https://forums.asp.net/t/2145886.aspx?How+to+open+the+jquery+dialog+from+the+Html+ActionLink+of+webgrid+ 
  • Khushbu Saini
    https://www.c-sharpcorner.com/blogs/model-popup-in-asp-net-core-31 Hi please visit this link this the solution of your problem ...of model popup over link button click
  • Farhan Ahmed
    @Html.ActionLink("Delete", "DeleteCategory", "Admin", new { item.CategoryID }, new {data_toggle = "modal", data_target = "#Delete", id="deleteActionLink", data_parameter="" })