Solved

Reading a xml File in a vb.net dropdown list

Posted on 2004-09-30
3
214 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Arduino EDI - Programming Language - Voice Recorder 4 94
Path to Python 9 128
ASP/VB email question 4 46
backup program with robocopy 6 42
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.

809 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