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.Request.Form in WebMethod Error: an object reference is required for non-static field, methodHi @kobinath,<br />Please try the following<br /><br /><a href = 'link(Threads/154221/Redirect-to-another-Page-from-Success-event-after-jQuery-AJAX-response-is-received/)'>Redirect to another Page from Success event after jQuery AJAX response is received</a><br /><br />It might help you.<br /><br />Cheers Andrea.https://www.aspforums.net:443/Threads/175866/RequestForm-in-WebMethod-Error-an-object-reference-is-required-for-non-static-field-method/https://www.aspforums.net:443/Threads/175866/RequestForm-in-WebMethod-Error-an-object-reference-is-required-for-non-static-field-method/Tue, 25 Dec 2018 01:47:46 GMTRequest.Form in WebMethod Error: an object reference is required for non-static field, method<p>sir if write the code it is more helpful for me</p>https://www.aspforums.net:443/Threads/175866/RequestForm-in-WebMethod-Error-an-object-reference-is-required-for-non-static-field-method/https://www.aspforums.net:443/Threads/175866/RequestForm-in-WebMethod-Error-an-object-reference-is-required-for-non-static-field-method/Tue, 25 Dec 2018 02:26:12 GMTRequest.Form in WebMethod Error: an object reference is required for non-static field, method<p>Hi&nbsp;kobinath,</p> <p>You can't use a non-static property in a static context. If your method is static it means it shouldn't depend on the instance being called (here you are using Request which is a property of this page).</p> <p>The correct way is to send your data as parameters to the function.</p> <p>Check this example. Now please take its reference and correct your code.</p> <p><strong><span style="text-decoration: underline;">HTML</span></strong></p> <pre class="brush: html">&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 addProject() { var id = 1; $.ajax({ type: &#39;POST&#39;, url: &#39;Insert.aspx/doSomething&#39;, dataType: &#39;JSON&#39;, data: &#34;{ id: &#39;&#34; + id + &#34;&#39;, fname: &#39;&#34; + $(&#39;#fname&#39;).val() + &#34;&#39;, age: &#39;&#34; + $(&#39;#age&#39;).val() + &#34;&#39; }&#34;, contentType: &#34;application/json; charset=utf-8&#34;, success: function (data) { alert(&#34;success&#34;); }, error: function (xhr, status, error) { alert(xhr.responseText); } }); } &lt;/script&gt; &lt;asp:TextBox runat=&#34;server&#34; ID=&#34;fname&#34; name=&#34;fname&#34; /&gt; &lt;asp:TextBox runat=&#34;server&#34; ID=&#34;age&#34; name=&#34;age&#34; /&gt; &lt;asp:Button Text=&#34;Save&#34; runat=&#34;server&#34; OnClientClick=&#34;addProject(); return false;&#34; /&gt;</pre> <p><strong><span style="text-decoration: underline;">C#</span></strong></p> <pre class="brush: csharp">[WebMethod] public static string doSomething(int id, string fname, int age) { string sql = &#34;insert into record values(&#39;&#34; + fname + &#34;&#39;,&#39;&#34; + age + &#34;&#39;)&#34;; SqlCommand cmd = new SqlCommand(sql, con); con.Open(); cmd.ExecuteNonQuery(); con.Close(); return &#34;Sucess&#34;; }</pre>https://www.aspforums.net:443/Threads/175866/RequestForm-in-WebMethod-Error-an-object-reference-is-required-for-non-static-field-method/https://www.aspforums.net:443/Threads/175866/RequestForm-in-WebMethod-Error-an-object-reference-is-required-for-non-static-field-method/Tue, 25 Dec 2018 23:34:29 GMT