2
Answers

How to search from XML file and display in WebForm

Photo of Pal

Pal

16y
3k
1

Hi! Any idea how I can perform search in XML file and then selected search result will appear in WebForm.

Briefly, I have few text boxes and my serach will be based on the keyword entered in those text boxes. Can anyone please give me idea for this. Thanks a lot for the answer.

RP

 

Answers (2)

0
Photo of Pal
NA 32 0 16y
Thanks for your reply.
0
Photo of Bechir Bejaoui
NA 20.1k 5.3m 16y
XmlDocument myDocument = new XmlDocument();

myDocument.Load(@"C:\XmlFile.xml");

XmlNodeList oNodeList = myDocument.SelectNodes("/Element");


txt0.text = oNodeList[0].innerText;
txt1.text = oNodeList[1].innerText;
.
.
tx[n].text = oNodeList[n].innerText;

or if you want to select node by node then use

selectsinglenode instead of SelectNodes
and xmlnode instead of xmlnodelist