abdujalil  chuliev

abdujalil chuliev

  • NA
  • 400
  • 41.3k

Control asp:xml tag by JS

Sep 6 2017 8:29 AM
I need help. In my old web page html was written using HtmlTextWriter and xml and xsl tags embedded like that:
 
  1. writer.WriteBeginTag("xml");  
  2. writer.WriteAttribute("id""data");  
  3. writer.WriteAttribute("src""/edit/source.aspx?objIntel=DataBase\\" + objIntel + "&filename=\\xmls\\" + number_appl + ".xml&un=" + username);  
  4. writer.Write(HtmlTextWriter.TagRightChar);  
  5. writer.WriteEndTag("xml");  
  6. writer.WriteLine();  
  7.   
  8. writer.WriteBeginTag("xml");  
  9. writer.WriteAttribute("id""style");  
  10. writer.WriteAttribute("src""/edit/source.aspx?objIntel=" + objIntel + "&filename=b7b.xsl&un=" + username);  
  11. writer.Write(HtmlTextWriter.TagRightChar);  
  12. writer.WriteEndTag("xml");  
  13. writer.WriteLine();  
 That "data" id was called by javascript like that:
  1. if (data.XMLDocument.text=="")  
  2. {  
  3.     showResult.innerHTML = "Object is missing";  
  4.     f1.subbuton.disabled=true;   
  5.     return;  
  6. }  
  7. showResult.innerHTML = data.transformNode(style.XMLDocument);  
Now I'm using xml tag in asp.net like that:
  1. <asp:Xml ID="data" runat="server" Visible="false" DocumentSource="~/20170001.xml"></asp:Xml>  
And using the same JS code. But it says: x800a1391 - JavaScript runtime error: 'data' is undefined. What is the way to control asp:xml by JS in this condition? Am I missing some concepts? 
 

Answers (1)