473,421 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,421 software developers and data experts.

Reading xml from hidden field using javascript

I want to read xml which is stored in hidden field using javascript
Jun 30 '09 #1
16 4965
Dormilich
8,658 Expert Mod 8TB
you can use the DOM to load the XML (see here).

PS: questions should go in the answers section not in insights
Jun 30 '09 #2
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 advance
Jun 30 '09 #3
Dormilich
8,658 Expert Mod 8TB
It's probably easier to read the XML file from the server.
Jun 30 '09 #4
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 avoided
Jun 30 '09 #5
Dormilich
8,658 Expert Mod 8TB
if you're using a hidden field, you have a postback anyway.
Jun 30 '09 #6
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 fast
Jun 30 '09 #7
Dormilich
8,658 Expert Mod 8TB
a) as long as you don't leave the page, the XML will be stored in cache by javascript

b) have to read it again a couple of times and think it over
Jun 30 '09 #8
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 feedback
Jun 30 '09 #9
Dormilich
8,658 Expert Mod 8TB
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()]
Jun 30 '09 #10
acoder
16,027 Expert Mod 8TB
For parsing and serializing XML, this is a good article.
Jun 30 '09 #11
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 field
Jun 30 '09 #12
Dormilich
8,658 Expert Mod 8TB
are you sure the XML is stored correctly (an attribute is usually not the proper place to store XML data)?
Jun 30 '09 #13
acoder
16,027 Expert Mod 8TB
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?
Jun 30 '09 #14
how to use ajax for my requirement as i explained in the above article
Jun 30 '09 #15
acoder
16,027 Expert Mod 8TB
This is a useful article. If you get stuck, post your code.
Jun 30 '09 #16
Thanks acoder & Dormilich for the suggestions this helped me a lot.
Jun 30 '09 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Randell D. | last post by:
Folks, Perhaps someone can figure this out - this is 'the process of my script' I have a form whereby I can add multiple contacts to a single address. There is only one...
8
by: Matt Herson | last post by:
I have been trying to find a way to use JavaScript to change the value of a hidden field on submit. I am already invoking a JavaScript to handle the validation on submit. The reason I need to...
1
by: Cy | last post by:
I have a form that contains several browse fields for users to upload files. There is also a hidden field that is populated using javascript. This script reads the value of the browse field,...
2
by: Rodusa | last post by:
I have a hidden field inside one datagrid which I can't get to make it keep its state after a postback event. Look field: <input type="hidden" id="TxtHiddenItem_id" name="TxtHiddenItem_id"...
4
by: Magnus Blomberg | last post by:
Hello! I have a problem when using a hidden field to send a value to the server. Below you can see my code in simplyfied versions. What I'm trying to do is: 1. The user browses for a picture...
2
by: xenophon | last post by:
I added a Hidden Form Field to a form in the code behind. The value is being set in JavaScript client-side, but it is not persisting to the server in the PostBack. I know the value is being set...
4
by: WB | last post by:
Hi, I need to validate a hidden input in my webform to ensure that it's got value. The controls look something like this: <input id="HidSelectedStates" type="hidden" runat="server" /><br...
2
by: Bill Steele | last post by:
I want to have a window pop up with a form. When the form is submitted, it needs to pass along the URL of the original window. If find on th web eight gazillion descriptions of how to pass data...
11
by: viki1967 | last post by:
Hidden field Hello my friends. This is a htm page that contains a form open in window popUp ( page daughter ). This form insert a value in the one hidden field called "tec", in other form...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.