title: Kendo UI Grid posting back already Inserted Rows again
body: <p>I am running into problem, where when an Insert is completed successfully and if i continue to insert another row, in the next insert it is also sending the row that was inserted successfully earlier, so it goes like this.
  On the First insert that row is posted back to webAPI and inserted successfully.
  On Next Insert Two rows are sent one of them was from first step.
  On third Insert it send previous two rows as well as third row and so on.</p>
  
  <p>What could be the cause of this ?</p>
  
  <p>This is the Code in problem.</p>
  
  <pre><code>$(document).ready(function () {
  try {
  
  var degreeYearsArray = new Array();
  
  function GetDegreeName(dgID, degreeName) {
      for (var i = 0; i &lt; degreeYearsArray.length; i++) {
          if (degreeYearsArray[i].dgID_PK == dgID) {
              return degreeYearsArray[i].Name;
          }
      }
      return degreeName;
  }
  
  var degreeYearModel = {
      id: "DGYR_PK",
      fields: {
          DGID_FK: {
              type: "number",
              nullable: false,
              editable: false
          },
          Code: {
              type: "string",
              validation: {
                  required: true,
                  minlength: 2,
                  maxlength: 160
              }
          },
          Year: {
              type: "number",
              validation: {
                  required: true
              }
          },
          EffectiveDate: {
              type: "date",
              validation: true
  
          },
          TerminationDate: {
              type: "date",
              validation: true
          }
      }
  }; 
  
  
  
  
  var baseURL = "http://localhost:3103/api/Degree";
  var degreeYearTransport = {
      create: {
          url: baseURL + "/PostDegreeYears", // "/PutOrgSchool",
          type: "POST",
          // contentType: "application/json"
          dataType: "json"
      },
      read: {
          url: function () {
              var newURL = "";
              if (window.SelectedDegree == null)
                  newURL =   baseURL + "/GetDegreeYears"
              else
                  newURL =  baseURL + "/GetDegreeYears?degreeID=" + window.SelectedDegree.DGID_PK;
              return newURL;
          },
         dataType: "json" // &lt;-- The default was "jsonp"
      },
      update: {
          url: baseURL + "/PutDegreeYears", //"/PostOrgSchool",
          type: "PUT",
          // contentType: "application/json",
          dataType: "json"
      },
      destroy: {
          url: function (employee) {
              return baseURL + "/deleteOrg" + employee.Id
          },
          type: "DELETE",
          dataType: "json",
          contentType: "application/json"
      },
      parameterMap: function (options, operation) {
          try {
  
  
              if (operation != "read") {
                  options.EffectiveDate = moment(options.EffectiveDate).format("MM-DD-YYYY");
                  options.TerminationDate = moment(options.TerminationDate).format("MM-DD-YYYY")
              }
              var paramMap = kendo.data.transports.odata.parameterMap(options);
  
              delete paramMap.$format; // &lt;-- remove format parameter.
  
              return paramMap;
  
          } catch (e) {
              console.error("Error occure in parameter Map or Degree.js" + e.message);
          }
  
      }
  }; //transport
  
  
  
  
  var dsDegreeYears = new kendo.data.DataSource({
      serverFiltering: true, // &lt;-- Do filtering server-side
      serverPaging: true, // &lt;-- Do paging server-side
      pageSize: 2,
      transport: degreeYearTransport,
      requestEnd: function (e) {
          try {
              if (e.type == "update"){
                  $.pnotify({
                      title: 'Update Sucessful',
                      text: 'Record was Updated Successfully',
                      type: 'success'
                  });
              }
  
              if (e.type == "create") {
                  $.pnotify({
                      title: 'Insert Sucessful',
                      text: 'Record was Inserted Successfully',
                      type: 'success'
                  });
              }
          } catch (e) {
              console.error("error occured in requestEnd of dsDegreeYears datasource in DegreeYears.js" + e.message);
          }
  
      },
      schema: {
          data: function (data) {
              return data.Items; // &lt;-- The result is just the data, it doesn't need to be unpacked.
          },
          total: function (data) {
              return data.Count; // &lt;-- The total items count is the data length, there is no .Count to unpack.
          },
          model: degreeYearModel
      }, //schema
      error: function (e) {
          var dialog = $('&lt;div&gt;&lt;/div&gt;').css({ height: "350px", overflow: "auto" }).html(e.xhr.responseText).kendoWindow({
              height: "300px",
              modal: true,
              title: "Error",
              visible: false,
              width: "600px"
  
          });
  
          dialog.data("kendoWindow").center().open();
      },
  
  });
  
  
  $("#" + gridName).kendoGrid({
      dataSource: dsDegreeYears,
      autoBind: false,
      groupable: true,
      sortable: true,
      selectable: true,
      filterable: true,
      reorderable: true,
      resizable: true,
      columnMenu: true,
      height: 430,
      editable: "inline",
      toolbar: ["create"],
      pageable: {
          refresh: true,
          pageSizes: true,
          buttonCount: 5
      },
      columns: [  {
                      field: "DGID_FK",
                      title: "Degree Name",
                      width: 140,
                      template: function (dataItem) {
                          if (window.SelectedDegree != null) {
                              dataItem.DGID_FK = window.SelectedDegree.DGID_PK;
                              return window.SelectedDegree.Name;
                          }
                          else
                              return "";
                      }
                  },
                  {
                      field: "Code",
                      title: "Code",
                      width: 140
                  },
                   {
                       field: "Year",
                       title: "Year",
                       width: 140
                   },
                 {
                     field: "Description",
                     width: 110
                 },
  
              {
                  field: "EffectiveDate",
                  width: 110,
                  format: "{0:MM/dd/yyyy}"
              },
              {
                  field: "TerminationDate",
                  width: 110,
                  format: "{0:MM/dd/yyyy}"
              },
  
               {
                   command: ["edit"] , title: "&amp;nbsp;", width: "172px"
               }
      ]
  }); //grid
  
  //Hide history pull-down menu in the top corner
  $.pnotify.defaults.history = false;
  $.pnotify.defaults.styling = "bootstrap";
  // styling: 'bootstrap'
  //styling: 'jqueryui'
  
  
  } catch (e) {
      console.error("Error occured in DegreeYears" + e.message);
  }
  </code></pre>
  
  <p>}); // document</p>
  
  <p>This is the Response that is sent from WebAPI</p>
  
  <pre><code> {"$id":"1","DGYR_PK":27,"DGID_FK":64,"Year":4,"Code":"4THYR","EffectiveDate":"2014-01-11T00:00:00","TerminationDate":"2014-01-11T00:00:00","CreatedByUserID_FK":1,"DateCreated":"0001-01-01T00:00:00","UpdatedByUserID_FK":1,"DateUpdated":"0001-01-01T00:00:00","RowStatusID_FK":1,"Degree":null,"DegreeYearExamSchedules":[],"User":null,"RowStatu":null,"User1":null,"DegreeYearSubjects":[]}
  </code></pre>
  
  <p>So i do see i am returning ID as suggested by the users in response to the question.
  still wondering</p>