click event launched only once problem

Posted by user281180 on Stack Overflow See other posts from Stack Overflow or by user281180
Published on 2010-05-21T06:02:58Z Indexed on 2010/05/21 6:10 UTC
Read the original article Hit count: 382

Filed under:
|
|

I have a form in which I have many checkboxes. I need to post the data to the controller upon any checkbox checked or unchecked, i.e a click on a checbox must post to the controller, and there is no submit button. What will be the bet method in this case? I have though of Ajax.BeginForm and have the codes below. The problem im having is that the checkbox click event is being detected only once and after that the click event isnt being launched. Why is that so? How can I correct that?

<% using (Ajax.BeginForm("Edit", new AjaxOptions { UpdateTargetId = "tests"}))
         {%>
               <div id="tests">
                    <%Html.RenderPartial("Details", Model); %>
               </div>
                <input type="submit" value="Save" style="Viibility:hidden" id="myForm"/> 
          <%}
          %>

$(function() {
 $('input:checkbox').click(function() {
        $('#myForm').click();
    });
  });

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about asp.net-mvc-2