hi all,
I'm doing this exercise displaying data from XML table to DataListControl
Now, I'd like to display the results to a DropDownList instead, and couldn't find an similar example anywhere. Can someone help me see a way!
I'm doing this exercise displaying data from XML table to DataListControl
Code:
<%@ Import Namespace="System.Data" %>
<html>
<head>
<title>Sample Page using VB.NET</title>
<script runat="server" language="VB">
Sub Page_Load
if Not Page.IsPostBack then
'load XML file to DataSet'
dim myCars=New DataSet
myCars.ReadXml (MapPath("cars2.xml"))
'bind the myCars DataSet to the Repeater control'
cars.DataSource=myCars
cars.DataBind()
end if
End Sub
</script>
</head>
<body>
<form runat="server">
<asp:DataList ID="cars" runat="server" CellPadding="2" CellSpacing="2" BackColor="#CCCCCC" Width="80%" HeaderStyle-Font-Name="Verdana" HeaderStyle-Font-Size="12pt" HeaderStyle-HorizontalAlign="center" HeaderStyle-Font-Bold="true" ItemStyle-BackColor="#0099CC" ItemStyle-ForeColor="#FFFFFF" AlternatingItemStyle-BackColor="#CC9933" AlternatingItemStyle-ForeColor="#000000" FooterStyle-Font-Size="9pt" FooterStyle-Font-Italic="true" FooterStyle-HorizontalAlign="right">
<headertemplate>
My Car Catalog
</headertemplate>
<itemtemplate>
<%#Container.DataItem("year")%> <%#Container.DataItem("manufacturer")%> <%#Container.DataItem("model")%>
</itemtemplate>
<alternatingitemtemplate>
<%#Container.DataItem("year")%> <%#Container.DataItem("manufacturer")%> <%#Container.DataItem("model")%>
</alternatingitemtemplate>
<footertemplate>
© Patrick Huynh
</footertemplate>
</asp:DataList>
</form>
</body>
</html>
Now, I'd like to display the results to a DropDownList instead, and couldn't find an similar example anywhere. Can someone help me see a way!