我将查询绑定到javascript元素中。如下所示
StrPriFnName = "FunGetAddInfo1(" + document.getElementById('CmbDocumentType').value + ")";
var ObjPriXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP");
ObjPriXMLHTTP.open("GET", "FrmInwardXMLHTTP.aspx?para=" + StrPriFnName, false);
ObjPriXMLHTTP.send("");
var StrStatusXMLHTTP = ObjPriXMLHTTP.responseText;
if (ObjPriXMLHTTP.responseText != "") {
StrPriRow = ObjPriXMLHTTP.responseText.split('|');
for (IntPriI = 0; IntPriI < StrPriRow.length - 1; IntPriI++) {
StrPriCol = StrPriRow[IntPriI].split('~');
var ObjPriOption = document.createElement("hidden");
ObjPriOption.text = StrPriCol[1];
ObjPriOption.value = StrPriCol[0];
document.getElementById('HidEmailId').value = ObjPriOption.value;
}
}
}
但是,我没有在HidEmailId
因为我的ObjPriOption.value
包含值。
如何在隐藏字段中分配值
答案 0 :(得分:1)
尝试
document.getElementById('<%= HidEmailId.ClientID %>').value;
您正在使用根据ID
更改contentplaceholder id
的asp.net隐藏字段