Hinal Shah

Hinal Shah

  • NA
  • 20
  • 7k

Access Hidden field value in WebMethod

Jun 8 2017 8:15 AM
Hello ,
I want to access hidden field value to the server side in asp.net in webMethod.
 
 
here is my code:-
 
 
function BtnGetData() {
 
var rr = $("#ddlAssignUser option:selected").length;
$("#hidUsercount").val(rr);
 
$.ajax({
type: "POST",
contentType:"application/json; charset=utf-8",
dataType:"json",
url: "AssignTender.aspx/GetData",
data:"{}",
success:function(data){
var obj = data.d;
alert(obj);
},
error: function (result) {
alert("error");
}
});
}
</script>
 
 
here i am using html tag in asp.net application because of requriement...
 
 
here is my html tags:-
 
 <select id="ddlAssignUser" class="form-control" runat="server" multiple="true"> </select>
 
<input type="hidden" id="hidUsercount" runat="server" name="hidUsercount" />
 
Now using jquery i have get the length of ddlAssignUser and store it in the Hiddenfield.
 
 I want this HiddenField value to access on server side in WenMethod.
 
 
 
 

Answers (1)