Solved

Reading a xml File in a vb.net dropdown list

Posted on 2004-09-30
3
209 Views
Last Modified: 2010-04-17
Hi
I am developing a web application in which I have a XML file whose values I need to read in a vb.net dropdown list . How would I do this ?

I can create my  xml file in of the type. I do have the flexibility of creating the xml file of anyformat easy for programming. The ID is stored as the value of the dropdownlist and the name is the display of dropdown list.
<Groups>
<name id=123>Groupname1</name>
<name id=12>Groupname1</name>
</Groups>
0
Comment
Question by:ChanderMadhavi
3 Comments
 
LVL 4

Accepted Solution

by:
itcnbwise earned 250 total points
Comment Utility
It's been a while since I worked with this, but here's some old code I had which will go through an XML file and print the id and value.  Yiou just have to add the drop-down box code.

Sub Page_Load(S As Object, E As EventArgs)

      If Not IsPostBack Then
                        DIM xpthdoc1 as XPathDocument
                        DIM xpthnv1 as XPathNavigator

              xpthdoc1=new XpathDocument(server.mappath("groups.xml"))
              xpthnv1=xpthdoc1.CreateNavigator()
              
              xpthnv1.MoveToRoot()
              xpthnv1.MoveToFirstChild()
       
            while (xpthnv1.MoveToFirstChild())
                  Response.Write(xpthnv1.name & ": " & xpthnv1.Value & "<br>")

                            while (xpthnv1.MoveToNext())
                        Response.Write("2" &xpthnv1.name & ": " & xpthnv1.Value & "<br>")
                  end while

            end while

      End If

End Sub
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
A short article about problems I had with the new location API and permissions in Marshmallow
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now