<?xml version= "1.0"?>
<products>
<product id="001">
<division>Division1</division>
<name>AName</name>
<model>Model1</model>
<category></category>
<datathumbURL>image.jpg</datathumbURL>
<datasheetURL>document.pdf</datasheetURL>
<thumbURL>image.png</thumbURL>
<fullImageURL></fullImageURL>
<description>Many, many words here</description>
<contactSnail>address, city, state, zip</contactSnail>
<contactDigits>phone</contactDigits>
<contactWebsite>URL</contactWebsite>
</product>
<product id="002">
<division>Division2</division>
<name>BName</name>
<model>Model2</model>
<category></category>
<datathumbURL>image.jpg</datathumbURL>
<datasheetURL>document.pdf</datasheetURL>
<thumbURL>image.png</thumbURL>
<fullImageURL></fullImageURL>
<description>many, many words here</description>
<contactSnail>address, city, state, zip</contactSnail>
<contactDigits>phone</contactDigits>
<contactWebsite>URL</contactWebsite>
</product>
<product id="003">
<division>Division3</division>
<name>CName</name>
<model>Model3</model>
<category></category>
<datathumbURL>image.jpg</datathumbURL>
<datasheetURL>document.pdf</datasheetURL>
<thumbURL>image.png</thumbURL>
<fullImageURL></fullImageURL>
<description>man, many words here</description>
<contactSnail>address, city, state, zip</contactSnail>
<contactDigits>phone</contactDigits>
<contactWebsite>URL</contactWebsite>
</product>
</products>
<script runat="server">
Sub Page_Load
dim dsProducts = New DataSet
dsProducts.ReadXml(MapPath("products.xml"))
Dim sid As String
sid = Request.QueryString("sid")
If String.IsNullOrEmpty(Request.QueryString("sid")) Then
dsProducts.Tables(0).DefaultView.Sort = "name, division, model ASC"
Elseif sid = "div" Then
dsProducts.Tables(0).DefaultView.Sort = "division, name, model ASC"
Elseif sid = "mod" Then
dsProducts.Tables(0).DefaultView.Sort = "model, name, division ASC"
End If
Dim dsProductsSort = dsProducts.Tables(0).DefaultView.ToTable()
dlProducts.DataSource = dsProductsSort
dlProducts.DataBind()
End sub
</script>
<asp:DataList id="dlProducts" runat="server">
<ItemTemplate>
<a href="products-details.aspx?id=<%#Container.DataItem("id")%>" style="color:blue"> <%#Container.DataItem("name")%> | <%#Container.DataItem("model")%></a> | <%#Container.DataItem("division")%>
</ItemTemplate>
</asp:DataList>
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
From novice to tech pro — start learning today.
Open in new window