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.
 
Back
Top