XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 24th, 2004, 03:26 AM
lbob lbob is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 2 lbob User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Sort XML File and use with asp dropdown

Hi

I've got an XML file that I use to populate an asp treeview control and a dropdown box. That works fine, although I now want to be able to sort the list of people in the dropdown list. Someone suggested using an XML template, but I'm a bit of an XML newbie and not sure how to do this. Can someone help.

This is what I've got to get the usernames out of the xml file and update fill the dropdown

Sub BuildXMLUsers()
'This loops thru the XML file and recursively calls ListXMLUSers to update the combo
'Restricts the combo to ONLY show the users listed in the XML file

dim oXMLNode
Dim sUniqueFileName
Dim iAdminUser, x, y, sDocument

'Gets the Querystring => retrieve the correct XML file
sDocument = document.location

x = instr(1,sDocument,"iAdmin=")
y = len(sDocument)

iAdminUser = right(sDocument, y - (x + 6))
sUniqueFileName = "XML/admin_users_" & iAdminUser & ".xml"

with oXML.XMLDocument
.async = false
if .load(sUniqueFileName) then
call ListXMLUsers(oXML.SelectSingleNode("/xml/user"))
else
msgbox "Couldn't load xml file because " & .parseError.reason
end if
end with

end sub

Sub ListXMLUsers(oXMLNode)
Dim oOption ' as object

set oOption = document.createElement("option")
call frmUser.cmbManager.options.add(oOption)

oOption.innerText = oXMLNode.selectSingleNode("@name").nodeValue
oOption.value = oXMLNode.selectSingleNode("@id").nodeValue

for each oXMLSubNode in oXMLNode.selectNodes("user")
Call ListXMLUsers(oXMLSubNode)
next

End Sub

Thanks
Lbob

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Sort XML File and use with asp dropdown


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT