|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Sort XML File and use with asp dropdown |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|