Hi,
I'm having another problem after solving this
Trying to read XML file but he is always the same
I'm creating HTML elements dynamically, and giving the values that i read from the XML file, the elements are always disappearing but after them been created. Any reason why that is happening? My Code is this in cs file
script = "function OnClientDragEnd(dock, args)" +
"{" +
" req = false; " +
" var isIE = false;" +
// branch for native XMLHttpRequest object
" if(window.XMLHttpRequest && !(window.ActiveXObject)) {" +
" try {" +
" req = new XMLHttpRequest();" +
" } catch(e) {" +
" req = false;" +
" }" +
// branch for IE/Windows ActiveX version
" } else if(window.ActiveXObject) {" +
" try {" +
" req = new ActiveXObject('Msxml2.XMLHTTP');" +
" } catch(e) {" +
" try {" +
" req = new ActiveXObject('Microsoft.XMLHTTP');" +
" } catch(e) {" +
" req = false;" +
" }" +
" }" +
" }" +
" if(req) {" +
" req.onreadystatechange = function(){processReqChange(dock,args)};" +
" req.open('GET', 'Config.xml', false);" +
" req.send('');" +
" }" +
"}" +
"function processReqChange(dock,args) {" +
// only if req shows "loaded"
" if (req.readyState == 4) {" +
// only if "OK"
" if (req.status == 200) {" +
// ...processing statements go here...
" var contagemNos = req.responseXML.documentElement;" +
" var txt = contagemNos.childNodes(i).getElementsByTagName('Titulo')[0].text;" +//alert(txt);
" var ta = contagemNos.childNodes(i).getElementsByTagName('Id')[0].previousSibling; var tatext = ta.text;" +//alert(tatext);
" var ni = document.getElementById('spanObjDock');" +
" var divIdName = 'myDiv';" +
" var newdiv = document.createElement('div');" +
" newdiv.setAttribute('id',divIdName);" +
" var labelTitulo = document.createElement('label');" +
" labelTitulo.id = 'span1';" +
" labelTitulo.innerHTML = 'Titulo';" +
" newdiv.appendChild(labelTitulo);" +
" var break1 = document.createElement('br');" +
" newdiv.appendChild(break1);" +
" var tboxTitulo = document.createElement('input');" +
" tboxTitulo.setAttribute('type', 'text');" +
" tboxTitulo.setAttribute('value', txt);" +
" tboxTitulo.setAttribute('name', 'tboxTitulo');" +
" tboxTitulo.setAttribute('id', 'tboxTitulo');" +
" if (tboxTitulo.addEventListener){" +
" var enviar = 'tboxTitulo';" +
" tboxTitulo.addEventListener('keyup', function(){updateValueTitulo(enviar);}, false);" +
" } else if (tboxTitulo.attachEvent){ " +
" var enviar = 'tboxTitulo';" +
" tboxTitulo.attachEvent('onkeyup', function(){updateValueTitulo(enviar);});" +
" }" +
" newdiv.appendChild(tboxTitulo);" +
" var break1 = document.createElement('br');" +
" newdiv.appendChild(break1);" +
" ni.appendChild(newdiv);" +
" } else {" +
" alert('There was a problem retrieving the XML data: ' + req.statusText);" +
" }" +
" }" +
"}";
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "PositionChanged", script, true);
and this is my code in aspx file
....
<asp:UpdatePanel runat="server" id="UpdatePanel3">
<ContentTemplate>
<div id="spanObjDock"></div>
</ContentTemplate>
</asp:UpdatePanel>
....