I am trying to call a Javascript function that will receive the ID of two asp listbox controls. I then would like to set these id's to variables that I will declare in the javascript. The function call is in bold below. It is done in codebehind.
((HtmlInputButton)e.Item.FindControl("btnPutIn")). Attributes.Add("onclick","moveSelectedOptions(docu ment.getElementById('"+e.Item.FindControl("lbOut") .ClientID+"'),document.getElementById('"+e.Item.Fi ndControl("lbIn").ClientID+"'),false);
JASONSNEWFUNCTION(document.getElementById('"+e.Ite m.FindControl("lbIn").ClientID+"'),document.getEle mentById('"+e.Item.FindControl("txtDisplayText").C lientID+"'),false);return false;");
Javascript function looks like this, it exists in a separate
js file:
function JASONSNEWFUNCTION(lbin,txtdisplay) {
var mylist=document.getElementById("lbin");
var mydisplay=document.getElementById("txtdisplay");
}
Visual Studio keeps telling me that my declared variables have a null value. But lbin and txtdispay do bring back id's when i check their values in the immediate window. I am very confused.I know that the function is being called. ( a good thing I guess!) Is there something wrong with my getElementById statement?
Jason