N K N K - 1 year ago 98
HTML Question

Assign variable value to hidden field

I am binding a query into the javascript element. like below

StrPriFnName = "FunGetAddInfo1(" + document.getElementById('CmbDocumentType').value + ")";
var ObjPriXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP");
ObjPriXMLHTTP.open("GET", "FrmInwardXMLHTTP.aspx?para=" + StrPriFnName, false);
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;

but, I am not getting value in

as my
contains value.

How to assign the value in the hidden field

Answer Source


document.getElementById('<%= HidEmailId.ClientID %>').value;

You are using asp.net hidden field whichs ID is changed according to contentplaceholder id

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download