I want to read xml which is stored in hidden field using javascript
Reading xml from hidden field using javascript
Collapse
X
-
Tags: None
-
Reading xml from hidden field using javascript
I tried with DOM but the problem is I am not able to read the xml from hidden field. I want to use this functionality because I will get xml using ds.GetXml() from codebehind & i store in hidden field so that i can access using javascript. This i want to use for listbox manipulation purposes. Thanks in advanceComment
-
but after manipulations of xml I want to store or retain the changes made in xml so i want to store it again using hidden field so that postback is avoidedComment
-
I will explain purpose: I have 4 list boxes i.e., two available & two selected listboxes (ie., 2 listboxes on top one available & another selected listboxes side to side similarly another two below it). if i select an item in the selected listbox on the top the respective item will be loaded in the below selected listboxes where i can remove the items of the selected item. this type of functionality i was handling in codebehind & i was storing in viewstate, but i want to do this in xml & javascript using hidden field for storing purposes. so that i can recall the changes if i store in hidden field so that process will be fastComment
-
thanks for the reply but i get xml from codebehind using ds.GetXml() method i don't want to create an xml file for this for only reading the xml file so i want to store in hidden field. can u pls tell me other methods so that i can read the xml without creating the xml file pls thanks in advance for you are feedbackComment
-
is this XML file submitted with the form (or rather, it is used in form processing)? (if you don't process the data on the server, there is no need for writing the data into the page)
if you already have the XML (be it a string or a document tree) you certainly don't need a file to read it from. you should be able to directly operate on the XML with DOM. [well, I don't know anything about ds.GetXml()]Comment
-
I want to read the xml which is stored in hidden field using javascript for me DOM is not working, i am not able to read the xml which i stored in hidden fieldComment
-
Firstly, how are you storing the XML in the hidden field? Can you show the code for that? It will be in string format, so you will need to use a parser to parse the string into XML format.
If you want to avoid a "postback", use Ajax. Then there's no need to store the XML in a hidden field. If you don't want to use Ajax and you store all of the data in XML, even then a hidden field is not required. Did you read the link I posted earlier?Comment
-
Comment