Solved

Reading a xml File in a vb.net dropdown list

Posted on 2004-09-30
3
211 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
ID: 12191364
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This is an explanation of a simple data model to help parse a JSON feed
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

947 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

22 Experts available now in Live!

Get 1:1 Help Now