title: how to update checkbox in webgrid
body: <p>excuse me, i try to make webgrid, in webgrid i put checkbox. i want to change value of checkbox. i have 5 row in webgrid, in first row, value of checkbox success to change. but in row two until five, the value can change. can some one tell me, what my mistake?</p>
  
  <p>this my view</p>
  
  <pre><code>&lt;div id="mygrid"&gt;
  &lt;/div&gt;
  &lt;div&gt;
      @{
          var grid = new WebGrid(Model.DataDiriList, rowsPerPage: 15, canPage: true, canSort: true, ajaxUpdateContainerId: "gridContent");
          @grid.GetHtml(
                             tableStyle: "row",
                    alternatingRowStyle: "alt",
                    columns: grid.Columns(
                    grid.Column("ID", format: @&lt;text&gt;  &lt;span  class="display-mode"&gt;@item.ID &lt;/span&gt; &lt;label id="UserID" class="edit-mode"&gt;@item.ID&lt;/label&gt; &lt;/text&gt;, style: "col1Width" ),
                    grid.Column("Nama", "Nama", format: @&lt;text&gt;  &lt;span  class="display-mode"&gt; &lt;label id="lblNama"  &gt;@item.Nama&lt;/label&gt; &lt;/span&gt; &lt;input type="text" id="Nama" value="@item.Nama" class="edit-mode" /&gt;&lt;/text&gt;, style: "col2Width"),
                    grid.Column("Umur", "Umur", format: @&lt;text&gt;  &lt;span  class="display-mode"&gt; &lt;label id="lblUmur"  &gt;@item.Umur&lt;/label&gt; &lt;/span&gt; &lt;input type="text" id="Umur" value="@item.Umur" class="edit-mode" /&gt;&lt;/text&gt;, style: "col2Width"),
                    grid.Column(header: "Active", format:@&lt;text&gt; &lt;span  class="display-mode"&gt; &lt;label id="lblActive"&gt;@item.ActiveStatus&lt;/label&gt; &lt;/span&gt; &lt;input id="chkActive" type="checkbox" @((item.Active == true) ? " checked=checked" : "") name="CloseSelling" value="@item.Active" class="edit-mode" onchange="adchange()" /&gt;&lt;/text&gt;, style: "col2Width"),
                    grid.Column("Action", format: @&lt;text&gt;
                                  &lt;button class="edit-user display-mode" &gt;Edit&lt;/button&gt;
                                  &lt;button class="save-user edit-mode"  &gt;Save&lt;/button&gt;
                                  &lt;button class="cancel-user edit-mode" &gt;Cancel&lt;/button&gt;
                              &lt;/text&gt;,  style: "col3Width" , canSort: false)
                   ));
      }
  &lt;/div&gt;
  
  @section scripts
      {
      &lt;script type="text/javascript"&gt;
  
          $(document).ready(function () {
              $('.edit-mode').hide();
              $('.edit-user, .cancel-user').on('click', function () {
                  var tr = $(this).parents('tr:first');
                  tr.find('.edit-mode, .display-mode').toggle();
              });
              $(function () {
                  $('#chkActive').click(function () {
                      alert($(this).val() + ' ' + (this.checked ? 'checked' : 'unchecked'));
                  });
              });
  
              $(".save-user").on("click", function () {
                  var tr = $(this).parent().parent();
                  var t = tr.find("#Nama").val();
                  var Umur = tr.find('#Umur').val();
                  var chkActive = $('#chk').attr('checked') ? "True" : "False";
                  var ID = tr.find('#UserID').html();
                  alert(chkActive);
  
                  $.ajax({
                      url: '@Url.Action("UpdateUser", "Home")',
                  type: "Post",
                  data: { CustomerNameId: t, UserID: ID, Umur: Umur,Active: chkActive},
                  dataType: 'json',
                  success: function (result) {
                      $("#mygrid").html('');
                      $("#mygrid").html(result);
                  }
                  });
  
                  tr.find("#lblNama").text(t);
                  tr.find("#lblUmur").text(Umur);
                  tr.find('.edit-mode, .display-mode').toggle();
          });
  
      });
  &lt;/script&gt;
      }
  </code></pre>
  
  <p>this Controller</p>
  
  <pre><code>public JsonResult UpdateUser(string CustomerNameId, string UserID, string Umur, bool Active)
          {
              var ID = Convert.ToInt32(UserID);
              var IntUmur = Convert.ToInt32(Umur);
              var dd = db.DataDiris.AsQueryable().Where(r =&gt; r.ID == ID).Single();
              dd.ID = ID;
              dd.Nama = CustomerNameId;
              dd.Umur = IntUmur;
              dd.Active = Active;
  
              db.Entry(dd).State = EntityState.Modified;
              db.SaveChanges();
              string message = "Success";
              return Json(message, JsonRequestBehavior.AllowGet);
          }
  </code></pre>
  
  <p>please help me</p>
  
  <p>thanks</p>