View Full Version : Sorting


jeo
05-17-2006, 08:59 AM
I can't figure out how to sort a field in Ascending order.
this is what i have:
<asp:TemplateField>
<HeaderTemplate>
<b><u>Live Date</u></b>
</HeaderTemplate>
<ItemTemplate>
<%#formatdatetime(Eval("TaskStartDt"), DateFormat.ShortDate)%>
</ItemTemplate>
</asp:TemplateField>I want to sort TaskStartDt in Ascedning onrder when it's displayed on the page.
Any ideas on how I can do that?
Thank you!

dan-cat
05-17-2006, 09:43 AM
I would recommend you do this from the datasource of your datagrid. ie sort your data as required before binding to the datagrid control.

Can you show us the script that binds your data to your datagrid?

jeo
05-17-2006, 10:35 AM
you pointed me in the right direction, so i put it in my sSQL condition statement and used ORDER BY before doing the databind statement.
thank you! really appreciate your suggestion.

dan-cat
05-17-2006, 11:07 AM
you pointed me in the right direction, so i put it in my sSQL condition statement and used ORDER BY before doing the databind statement.
thank you! really appreciate your suggestion.

Sorted! :D