ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.ASP.Net jQuery AJAX Error: Type System.Int32 is not supported for deserialization of an array<p>Hi&nbsp;suhaas121,</p> <p>Since you are passing&nbsp;Javascript Array to&nbsp;WebMethod through Ajax call you need to define int array in the WebMethod as parameter.&nbsp;</p> <p>Check the below modified code.</p> <p><strong><span style="text-decoration: underline;">HTML</span></strong></p> <pre class="brush: html">&lt;div&gt; &lt;input id=&#34;btndeletebookmark&#34; class=&#34;button&#34; type=&#34;button&#34; value=&#34;Delete&#34; /&gt; &lt;/div&gt; &lt;div class=&#34;row&#34;&gt; &lt;asp:CheckBoxList ID=&#34;lstBookmark&#34; runat=&#34;server&#34;&gt; &lt;asp:ListItem Text=&#34;Mango&#34; Value=&#34;1&#34; /&gt; &lt;asp:ListItem Text=&#34;Apple&#34; Value=&#34;2&#34; /&gt; &lt;asp:ListItem Text=&#34;Banana&#34; Value=&#34;3&#34; /&gt; &lt;asp:ListItem Text=&#34;Orange&#34; Value=&#34;4&#34; /&gt; &lt;/asp:CheckBoxList&gt; &lt;/div&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; $(function () { $(&#34;#btndeletebookmark&#34;).click(function (e) { e.preventDefault(); var ids = []; $(&#34;#lstBookmark input[type=&#39;checkbox&#39;]:checked&#34;).each(function () { ids.push(parseInt($(this).val())); }); $.ajax({ type: &#34;POST&#34;, contentType: &#34;application/json; charset=utf-8&#34;, url: &#34;Default.aspx/DeleteBookMark&#34;, data: JSON.stringify({ BookmnarkID: ids }), dataType: &#34;json&#34;, success: function (data) { alert(&#34;Bookmark Removed Successfully&#34;); location.reload(); }, error: function (result) { alert(result.responseText); } }); }) }); &lt;/script&gt;</pre> <p><strong><span style="text-decoration: underline;">Namespace</span></strong></p> <p><strong>C#</strong></p> <pre class="brush: csharp">using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Web.Services;</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Imports System.Configuration Imports System.Data Imports System.Data.SqlClient Imports System.Web.Services</pre> <p><strong><span style="text-decoration: underline;">Code</span></strong></p> <p><strong>C#</strong></p> <pre class="brush: csharp">[WebMethod] public static void DeleteBookMark(int[] BookmnarkID) { foreach (int id in BookmnarkID) { DeleteBookMark(id); } } public static void DeleteBookMark(int BookmarkID) { SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings[&#34;connString&#34;].ConnectionString); conn.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = &#34;usp_RemoveBookmark&#34;; cmd.CommandType = CommandType.StoredProcedure; SqlParameter param1 = new SqlParameter(&#34;@IN_BookmarkID&#34;, BookmarkID); cmd.Parameters.Add(param1); cmd.ExecuteNonQuery(); conn.Close(); }</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">&lt;WebMethod()&gt; Public Shared Sub DeleteBookMark(ByVal BookmnarkID As Integer()) For Each id As Integer In BookmnarkID DeleteBookMark(id) Next End Sub Public Shared Sub DeleteBookMark(ByVal BookmarkID As Integer) Dim conn As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings(&#34;connString&#34;).ConnectionString) conn.Open() Dim cmd As SqlCommand = New SqlCommand() cmd.Connection = conn cmd.CommandText = &#34;usp_RemoveBookmark&#34; cmd.CommandType = CommandType.StoredProcedure Dim param1 As SqlParameter = New SqlParameter(&#34;@IN_BookmarkID&#34;, BookmarkID) cmd.Parameters.Add(param1) cmd.ExecuteNonQuery() conn.Close() End Sub</pre> <p><strong><span style="text-decoration: underline;">Screenshot</span></strong></p> <p><strong><span style="text-decoration: underline;"><img src="https://i.imgur.com/R5NuGwu.jpg" alt="" width="472" height="125" /></span></strong></p>https://www.aspforums.net:443/Threads/605229/ASPNet-jQuery-AJAX-Error-Type-SystemInt32-is-not-supported-for-deserialization-of-an-array/https://www.aspforums.net:443/Threads/605229/ASPNet-jQuery-AJAX-Error-Type-SystemInt32-is-not-supported-for-deserialization-of-an-array/Fri, 14 Dec 2018 01:02:42 GMT