?
Solved

Reading a xml File in a vb.net dropdown list

Posted on 2004-09-30
3
Medium Priority
?
218 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
itcnbwise earned 1000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Make the most of your online learning experience.
Simple Linear Regression
Progress

762 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