Click here to Skip to main content
16,019,843 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I am binding the data from my DB sucessfully. But I want to show this data depending on a particular order.i,e either ascending or descending depending on date column. Without date column My code is like below:
<td style="width: 90%;"><%# Eval("Type").ToString().ToUpper() %><br />
</td>

I want to sort the data depending on the date. Can anybody suggest me the answer for this.

Thank you
BIkash
Posted
Updated 15-Nov-15 18:41pm
v3
Comments
[no name] 16-Nov-15 0:42am    
You can implement sorting logic when retrieve data from DB. Please explain more "sorting on date column".
Salman622 16-Nov-15 1:51am    
you can query the data from db in the order you want.
Sinisa Hajnal 16-Nov-15 2:35am    
Either return sorted data from the database or sort after retrieving, but before binding. Good luck.
[no name] 16-Nov-15 3:24am    
can you explore little more how you bind the data ?

1 solution

sort in query like
select * from tblname order by datecolumn asc

or before binding i assume as you are using datatable name as dt

dt.DefaultView.Sort = "datecolumn ASC";

*for descending order use desc
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900