narasiman rao

narasiman rao

  • NA
  • 519
  • 743.5k

Fetch value using hidden field but not worked

Sep 16 2016 1:29 AM
 My code as follows
 
 
function AddNewCriticalResource() {
var pro = $("#ms").val();
var ProjectIds = pro.toString();
var projectNames = $("#ms").text();
var addordelete = 1;
$.ajax({
type: "POST",
url: "CriticalResource.aspx/AddNewCriticalResource",
contentType: "application/json; charset=utf-8",
data: '{ stringAssociateIds: "' + associates + '", stringProjectIds: "' + ProjectIds + '", stringTaggedBy:"' + AssocID + '" }',
dataType: "json",
responseType: "json",
cache: false,
success: function (msg) {
var TableData = $.parseJSON(msg.d);
var alertString = '';
noOfRows = 0;
$.each(TableData, function (i, data) {
alertString = alertString + data.AssociateID + '-' + data.ProjectName + ', ';
noOfRows = i + 1;;
});
from the above code i want to get projectNames into code behind page.
i tried my code as follows
 
var projectNames = $("#ms").text();
 
$("#projectNames").val($("#ms").text());
 
<input type="hidden" id="projectNames" runat="server" clientidmode="Static"/>
 
My code behind page code as follows
 
string projectid = projectNames.Value; 
 
 var supplyData = this.objBusinessLayer.FetchCriticalResourceDetailsOnProjectId(projectid);
 
when i check the above code in code behind page, in the above line
 
 
string projectid = projectNames.Value;
in projectname value is not coming.
 
can you please tell me. what  is the mistake in my code. i tried but it is not working.
 
 
 

Answers (2)