sorting datalist in ASP.Net?

  • Thread starter Thread starter LRW
  • Start date Start date
L

LRW

Is it possible?
Here's the opening block of my datalist in the ASPX page,
and I was wondering if there's a way to sort the output by
a particular field:
<asp:datalist ID="dgProducts" runat="server"
Width="100%" Border="0"
HorizontalAlign="Left" EditItemStyle-
HorizontalAlign="left" ItemStyle-HorizontalAlign="left"
CssClass="text" CellPadding="4" CellSpacing="4"
RepeatDirection = "Vertical"
RepeatColumns="3" >
<ItemTemplate>

I've tried doing it at the dataview with a line:
dvContent.Sort = "PRD_ID ASC"
but that didn't change anything.

Thanks for any suggestions!
Liam
 
Don't know if this will help but, that sort equation should work, but you do
have to be careful of values as strings vs numbers. (You may need to add a
column with datatype system.int32 values to your table to sort it properly.)
Also, I think the sort string is case sensative so make sure you match the
column values in your table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

datagrid 1
Show tif or pdf in DataList 2
Question on accessing a nested GridViews Events 1
Question about DataList 1
ASP.NET Datagrid 1
DataGrid Paging 1
Set Datalist height dynamically 3
Trying to use FindControl 11

Back
Top