Hi, I have problem with JS syntax, I have syntax as below: document.getElementById('<%= SearchCriteriaControls.FindControl("PoleWyboru").ClientID %>').value = getQuerystring(array); and it works. but when I want to pass in FindControl argument as controlID: var pole = "PoleWyboru"; document.getElementById('<%= SearchCriteriaControls.FindControl("'+ pole +'").ClientID %>').value = getQuerystring(array); I've got object null reference. Why I can't pass argument to findControl method in JS ? I have loop like this: for (var i = 0; i < array.length; ++i) { var pole = "PoleWyboru"; document.getElementById('<%= SearchCriteriaControls.FindControl("'+ pole +'").ClientID %>').value = getQuerystring(array); } thanx for any help !
I guess its a mistake with the following line : document.getElementById('<%= SearchCriteriaControls.FindControl("'+ pole +'").ClientID %>').value = getQuerystring(array[i]); Code (markup): Try changing ur code to this : var pole = "PoleWyboru"; var clientId = <%= SearchCriteriaControls.FindControl(pole).ClientID %> document.getElementById(clientId).value = getQuerystring(array[i]); Code (markup):