c# - No parameterless constructor defined for type of.. Error while Ajax JQuery call -


i getting below error when execute ajax jquery:

enter image description here

below code using:
iprrequest.cs class code(.dll)

public static bool isvalidbarcodetest(guid? requestid, string barcode)         {             bool result = true;              dictionary<string, object> input = new dictionary<string, object>()                {                  {"@requestid", requestid},                 {"@barcodeno", barcode}             };             data data = new data();             datatable dt = data.executequery(commandtype.storedprocedure, "invoice.usp_tbl_request_select_checkduplicatebarcode_test", input);             if (dt.rows.count > 0)             {                 result = helper.getdbvalue<int>(dt.rows[0][0]) == 0;             }             return result;         } 

.aspx.cs page code:

public abstract class check     {         public abstract guid? requestid { get; set; }         public abstract string barcode { get; set; }     }      [webmethod]     [scriptmethod]     public static bool checkduplicate(check chk)     {         bool isexist = false;          isexist = iprrequest.isvalidbarcodetest(chk.requestid, chk.barcode);          return isexist;     } 

ajax jquery code:

<script type="text/javascript">     $(document).ready(function () {         $("[id*=btnsave]").bind("click", function () {              var chk = {};             chk.requestid = $("[id*=tempguid]").text();             alert(chk.requestid);             chk.barcode = $("[id*=txtbarcodenumber]").val();             alert(chk.barcode);              $.ajax({                 type: 'post',                 url: "iprform_editcheck.aspx/checkduplicate",                 data: '{chk: ' + json.stringify(chk) + '}',                 contenttype: 'application/json; charset=utf-8',                 datatype: 'json',                 success: function (data) {                      var val = data.d;                     alert(val);                      if (val == true) {                         alert("barcode number exist in system database.");                     }                     else {                         alert("barcode number not exist");                     }                  },                 error: function (data) {                     alert(data.responsetext);                 },             });             return false;         });     }); </script> 

stored procedure

select          case when count(1) > 0             1 --exist             else 0 --not exist         end duplicate     invoice.tbl_request(nolock)      barcodeno = @barcodeno         , (@requestid null or requestid <> @requestid) 

please reply wrong in code.
please note new in ajax jquery , web method
in advance.

.net needs create object of type check pass parameter webmethod checkduplicate. cannot create object of abstract class.

if change class check following, should work:

public class check {     //this constructor needed, .net create      //it automatically if no other constructors defined     public check() { }      private guid? requestid;     private string barcode;      public guid? requestid     {         { return requestid; }         set { requestid = value; }     }      public string barcode     {         { return barcode; }         set { barcode = value; }     } } 

Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -