Hi,

I am developing an application on .Net and wish to use XML for drop down list. I do not want the drop down list to have repetitive data. For e.g If my drop down list has Countries and their States as L1 and L2 table respectively, I do not want L1 to repeat name of the country (e.g India) 30+ times as those many states of India get listed on L2.

Sub fillLevel2(ByVal level1 As String, ByVal dd As DropDownList)
Dim strXML As String = Server.MapPath("~") & "\xmlFiles\LOV.xml"
Dim xdoc1 As New XPathDocument(strXML)
Dim xNav1 As XPathNavigator = xdoc1.CreateNavigator()
Dim xNodeIterator1 As XPathNodeIterator
Dim xPathExpr1 As XPathExpression = xNav1.Compile("(//Table[LOVLevel1 ='" & level1 & "'])/LOVLevel2")
xPathExpr1.AddSort(".", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Text)
xNodeIterator1 = xNav1.Select(xPathExpr1)
While xNodeIterator1.MoveNext()
dd.Items.Add(xNodeIterator1.Current.Value)
End While
dd.Items.Insert(0, New ListItem("Select Level2", ""))
End Sub

Thanks in advance for the assistance