c# - To get Dropdownlist selected value inside static method -


in below code have static method inside static method want dropdown selected value.pls me this.

[webmethod] public static void insertdata() {  }       <asp:dropdownlist id="divlocation" runat="server" style="width:40%;" enableviewstate="true"/> 

here example of ajax

$.ajax({             type: "post",             contenttype: "application/json; charset=utf-8",             url: "pagename.aspx/webmethodname",             data: json.stringify({ dropdownvalue: $('select[id$=divlocation]').val()}),             datatype: "json",             async: false,             success: function (data) {                 alert("success");              },             error: function (err) {                 alert(err.responsetext);             }          }); 

and in webmethod receive value this

[webmethod]     public static void insertdata(string dropdownvalue)     {       } 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -