title: Error in Update,delete,Edit operation in JTable in ASP.net Application, while selection works perfectly
body: <p>I am having following errors in the ASP.net page . I am using a plugin called jTable( Reference jTable.org). This plugin is used to bind JSON with the HTML UI.</p>
  
  <p><img src="https://i.stack.imgur.com/4hQLx.png" alt="enter image description here"></p>
  
  <p>I am using following model</p>
  
  <pre><code>[DataContract]
      public class UserGroup
      {
          public UserGroup()
          {
              GroupId = 0;
          }
  
          #region Properties
  
          public short GroupId { get; set; }
  
          [DataMember]
          public string GroupCode { get; set; }
  
          [DataMember]
          public char GroupType {get;set;}
  
          [DataMember]
          public string GroupDescription { get; set; }
          #endregion
      }
  </code></pre>
  
  <p>Here is the ASPX code</p>
  
  <pre><code>&lt;%@ Page Title="" AutoEventWireup="false" ViewStateMode="Disabled" Language="C#" MasterPageFile="~/Admin/Admin.Master"  CodeBehind="Groups.aspx.cs" 
  Inherits="ERP.WebApp.Admin.Groups" %&gt;
  
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"&gt;
      &lt;link href="../Content/themes/redmond/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" /&gt;
      &lt;!-- jTable style file --&gt;
  
      &lt;link href="/Scripts/jtable/themes/standard/blue/jtable_blue.css" rel="stylesheet" type="text/css" /&gt;
  
      &lt;script src="/Scripts/jquery-ui-1.8.16.custom.min.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="/Scripts/modernizr-1.7.min.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="/Scripts/jtablesite.js" type="text/javascript"&gt;&lt;/script&gt;
  
      &lt;!-- A helper library for JSON serialization --&gt;
      &lt;script type="text/javascript" src="/Scripts/jtable/external/json2.min.js"&gt;&lt;/script&gt;
      &lt;!-- Core jTable script file --&gt;
      &lt;script type="text/javascript" src="/Scripts/jtable/jquery.jtable.min.js"&gt;&lt;/script&gt;
      &lt;!-- ASP.NET Web Forms extension for jTable --&gt;
      &lt;script type="text/javascript" src="/Scripts/jtable/extensions/jquery.jtable.aspnetpagemethods.min.js"&gt;&lt;/script&gt;
  
  &lt;/asp:Content&gt;
  &lt;asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"&gt;
  &lt;br /&gt;&lt;br /&gt;
  &lt;div style="width:70%;margin:auto;height:500px"&gt;
  &lt;div id="GroupTableContainer"&gt;&lt;/div&gt;
  &lt;/div&gt;
   &lt;script type="text/javascript"&gt;
  
       $(document).ready(function () {
  
           //Prepare jtable plugin
           $('#GroupTableContainer').jtable({
               title: 'List of User Groups',
               paging: true, //Enables paging
               pageSize: 10, //Actually this is not needed since default value is 10.
               sorting: true, //Enables sorting
               defaultSorting: 'GroupCode ASC', //Optional. Default sorting on first load.
               actions: {
                   listAction: '/Admin/Groups.aspx/GroupsList',
                   createAction: '/Admin/Groups.aspx/CreateGroup',
                   updateAction: '/Admin/Groups.aspx/UpdateGroup',
                   deleteAction: '/Admin/Groups.aspx/DeleteGroup'
               },
               fields: {
                   GroupId: {
                       key: true,
                       create: false,
                       edit: false,
                       list: false                     
                   },
                   GroupCode: {
                       title: 'Group Code',
                       width: '15%'
                   },
                   GroupType: {
                       title: 'Group Type',
                       width: '25%',
                       options: { 'S': 'Student', 'F': 'Faculty', 'A': 'Accounts', 'M': 'Management', 'B': 'Library Staff', 'L': 'Lab Staff', 'E': 'E.R.P. Admins','T':'Training &amp; Placement' }
                   },
                   GroupDescription: {
                       title: 'About the Group',
                       type: 'textarea',
                       width: '50%'
                   }
               }
           });
  
           //Load Groups list from server
           $('#GroupTableContainer').jtable('load');
       });
  
  &lt;/script&gt;
  &lt;br /&gt;&lt;br /&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>And here is the ASPx.cs code that I am using</p>
  
  <pre><code>[WebMethod(EnableSession = true)]
          public static object GroupsList(int jtStartIndex = 0, int jtPageSize = 10, string jtSorting = null)
          {
              try
              {
                  short pTotalRows = 0;
                  List&lt;UserGroup&gt; groupList = new GroupsBL().GetAllUserGroups(out pTotalRows,(short)jtStartIndex,(byte) jtPageSize, jtSorting);
  
                  //Return result to jTable
                  return new { Result = "OK", Records = groupList, TotalRecordCount = pTotalRows };
              }
              catch (Exception ex)
              {
                  return new { Result = "ERROR", Message = ex.Message };
              }
          }
  
          [WebMethod(EnableSession = true)]
          public static object CreateGroup(UserGroup pUserGroup)
          {
              try
              {
                  var addedStudent = new GroupsBL().AddUserGroup(pUserGroup);
                  if (addedStudent == true)
                      return new { Result = "OK"};
                  else
                      return new { Result = "ERROR", Message = "Group Already Exists" };
              }
              catch (Exception ex)
              {
                  return new { Result = "ERROR", Message = ex.Message };
              }
          }
  
          [WebMethod(EnableSession = true)]
          public static object UpdateGroup(UserGroup pUserGroup)
          {
              try
              {
                  var updatedstudent = new GroupsBL().UpdateUserGroup(pUserGroup);
                  if (updatedstudent == true)
                      return new { result = "ok"};
                  else
                      return new { Result = "ERROR", Message = "Group Already Exists" };
              }
              catch (Exception ex)
              {
                  return new { Result = "ERROR", Message = ex.Message };
              }
          }
  
          [WebMethod(EnableSession = true)]
          public static object DeleteGroup(int pGroupId)
          {
              try
              {
                  var deletedStudent = new GroupsBL().DeleteUserGroup((short)pGroupId);
                  if(deletedStudent == true)
                  return new { Result = "OK" };
                  else
                      return new { Result = "ERROR" };
              }
              catch (Exception ex)
              {
                  return new { Result = "ERROR", Message = ex.Message };
              }
          }
  </code></pre>
  
  <p>Selection operation with paging is working fine while any other operation like updation,deletion,creating results in same error. that is shown through Firebug plugin in the screenshot above or as follows.</p>
  
  <p><strong>{"Message":"Invalid web service call, missing value for parameter: \u0027pUserGroup\u0027.","StackTrace":"   at System.Web.Script.Services.WebServiceMethodData.CallMethod(Object target, IDictionary<code>2 parameters)\r\n   at System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target, IDictionary</code>2 parameters)\r\n   at System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)\r\n   at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.InvalidOperationException"}</strong></p>