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
Post a Comment