asp.net mvc 3 - How to make a table cell clickable with an Ajax.ActionLink -
asp.net mvc 3 - How to make a table cell clickable with an Ajax.ActionLink -
i have table cell want user able click go ajax action, have like
<td class="code-cell"> @ajax.actionlink(model.code, "edit", "mycontroller", new { id = model.id }, new ajaxoptions { httpmethod = "get", updatetargetid = "edit", insertionmode=insertionmode.replace }, new { @class = "code-link" }) </td>
which puts link in table cell.
but want user able click on cell rather having click link.
using jquery can wire event handler click on td (via class) , find kid link , click it. i'm having problem understanding event propagation, etc.
i have this:
<script type="text/javascript"> $(function () { $(".code-cell").click(function (e) { e.preventdefault(); e.stoppropagation(); $("a", this).triggerhandler("click"); }); }); </script>
even though i've tried calls e.preventdefault() , e.stoppropagation() (and various combinations!) can't seem work.
what's right way this?
have tried:
return false;
hope helps
asp.net-mvc-3
Comments
Post a Comment