Hi,
I'm new to ASP and am somewhat confused about the way my DataList is displaying the data from an alphabetically sorted DataSet.
I have retrieved my DataSet from my database, and stepped through the data row by row, but my DataList is displaying the data in a random manner, i.e. there doesn't appear to be any order to the data displayed.
How can I ensure that the DataList displays the data in the same order as my DataSet is ordered?
If it will help. here is my code that binds my DataSet to my DataList
<pre lang="c#">
OleDbConnection pageConnection = new OleDbConnection(@" provider=Microsoft.ace.Oledb.12.0; data source=C:\Projects\MyDatabase.accdb;Persist Security Info=False");
OleDbDataAdapter listCommand = new OleDbDataAdapter("select * from Table", pageConnection);
DataSet listDS = new DataSet();
// Create and fill a DataSet.
listCommand.Fill(listDS);
DataList1.DataSource = listDS;
DataList1.DataBind();
</pre>
<pre lang="HTML">
<asp:DataList ID="DataList1" runat="server" Style="position:absolute; top: 255px; left: 265px; height: 397px; width: 500px; margin-top: 0px;" RepeatColumns="2" >
<HeaderTemplate>
<table width="100%">
<tr align="left">
<th>
Parameter
</th>
<th>
Value
</th>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<tr align="left">
<td>
<%# DataBinder.Eval(Container.DataItem, "Parameter") %>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "Value") %>
</td>
</tr>
<div style="padding:15,15,15,15;font-size:10pt; font-family:Verdana">
</div>
</ItemTemplate>
</asp:DataList>
</pre>
TIA
Tony