title: Jtable error while deleting
body: <p>Ihis was my first attempt to <code>Jtable</code>. And everything works fine,except the delete option. Its giving an error:</p>
  
  <blockquote>
    <p>"Error occurred while communicating to the server"</p>
  </blockquote>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function () {
              $("#department_v").jtable({
                  title: 'Department Entry',
                  selecting: true, //Enable selecting
                  multiselect: true, //Allow multiple selecting
                  selectingCheckboxes: true, //Show checkboxes on first column
  
                  paging: true, //Enables paging
                  pageSize: 10, //Actually this is not needed since default value is 10.
                  sorting: true, //Enables sorting
                  defaultSorting: 'id ASC', //Optional. Default sorting on first load.
                  actions:
                  {
  
                      listAction: '/frmAdmin.aspx/DepartmentList',
                      deleteAction: '/frmAdmin.aspx/DeleteDepartment',
                      createAction: '/frmAdmin.aspx/CreateNewDepartment',
                      updateAction: '/frmAdmin.aspx/UpdateDepartment',
  
  
                  },
                  fields:
                  {
                      id:
                      {
                          title: 'id',
                          key: true,
                          list: true,
                          edit: false
  
                      },
                      Dept_Name:
                      {
                          title: 'DepartmentName',
                          width: '13%'
                      },
  
  
  
                  },
  
  
  
                  formCreated: function (event, data) {
                      data.form.find('input[name="Dept_Name"]').addClass('validate[required]');
  
                      data.form.validationEngine();
                  },
  
                  formSubmitting: function (event, data) {
                      return data.form.validationEngine('validate');
                  },
  
                  formClosed: function (event, data) {
                      data.form.validationEngine('hide');
                      data.form.validationEngine('detach');
                  }
  
  
  
  
              });
  
              $('#department_v').jtable('load');
          });
      &lt;/script&gt;
  
  [WebMethod(EnableSession = true)]
      public static object DepartmentList(int jtStartIndex, int jtPageSize, string jtSorting)
      {
          try
          {
              //Get data from database
              using (var db = new HRISDBEntities())
              {
                  var DepartmentResult = (from DepartmentList in db.tbl_Department select DepartmentList).ToList();
                  if (DepartmentResult.Count != 0)
                      return new { Result = "OK", Records = DepartmentResult };
                  else return 0;
              }
          }
          catch (Exception ex)
          {
              return new { Result = "ERROR Reading Database", Message = ex.Message };
          }
  
      }
  
  
      [WebMethod(EnableSession = true)]
      public static object CreateNewDepartment(Department record)
      {
          try
          {
              using (var db = new HRISDBEntities())
              {
                  var newTblMember = new tbl_Department
                  {
                      Dept_Name = record.Dept_Name
  
                  };
                  var NewEmpAdd = db.tbl_Department.Add(newTblMember);
                  db.SaveChanges();
                  return new { Result = "OK", Records = NewEmpAdd };
              }
          }
          catch (Exception ex)
          {
              return new { Result = "ERROR", Message = ex.Message };
          }
      }
  
  
  
  
      [WebMethod(EnableSession = true)]
      public static object DeleteDepartment(int record)
      {
          try
          {
  
              using (HRISDBEntities db = new HRISDBEntities())
              {
                  var deletedmember = db.tbl_Department.First(e =&gt; e.id == record);
                  db.tbl_Department.Remove(deletedmember);
                  db.SaveChanges();
                  return new { Result = "OK" };
  
              }
          }
          catch (Exception ex)
          {
              return new { Result = "ERROR", Message = ex.Message };
          }
  
      }
  
  
  
      [WebMethod(EnableSession = true)]
      public static object UpdateDepartment(Department record)
      {
          try
          {
              int memid =  record.id;
              using (HRISDBEntities db = new HRISDBEntities())
              {
                  var updateuser = (from member in db.tbl_Department
                                    where (member.id == memid)
                                    select member).FirstOrDefault();
                  updateuser.Dept_Name = record.Dept_Name;
  
                  db.tbl_Department.Attach(updateuser);
                  var entry = db.Entry(updateuser);
                  entry.Property(e =&gt; e.Dept_Name).IsModified = true;
  
                  db.SaveChanges();
                  return new { Result = "OK", };
              }
          }
          catch (Exception ex)
          {
              return new { Result = "ERROR", Message = ex.Message };
          }
      }
  </code></pre>
  
  <p>Getting following error </p>
  
  <p><a href="https://i.stack.imgur.com/ta6b6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ta6b6.png" alt="Error message"></a></p>
  
  <p>I'm using Entity Framework 6.x  </p>
  
  <p>Thanks!  </p>