Click here to Skip to main content
15,900,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to show Auto Number in Descending Order?
Posted
Updated 15-Mar-11 2:27am
v2
Comments
m@dhu 15-Mar-11 8:25am    
So whats your question.
Henry Minute 15-Mar-11 8:29am    
Please edit your question to indicate if this is a Windows Forms or ASP.Net or something else.

As you use 'GridView' I would guess ASP.Net, but it would only be a guess.
LebneizTech 15-Mar-11 8:55am    
Sir, I am using ASP .Net (Web Based)
I am binding a Grid,First Column is Auto Number : Using <%# Container.DataItemIndex+1 %>.
It Shows 1,2,3,4....44,45.in Ascending Order.BUT,
I require in Descinding Order like: 45,44,43 .....3,2,1.
Albin Abel 15-Mar-11 9:02am    
If you know the total items then <%# TotalItems-Container.DataItemIndex %>.
LebneizTech 15-Mar-11 9:04am    
There is no Total Items Known,Depends on Table Contents(Rows)

1 solution

You just answered the question yourself. If there is no way to know what the total number of records is then how could one possibly count downward. If you can count backward towards one then you know the total number of records by looking at the index of the first record. So if it is indeed impossible to know the total number of records it is also impossible to count backwards from that number towards one!

Eagerly awaiting your rebuttal!
 
Share this answer
 
Comments
Albin Abel 15-Mar-11 9:26am    
My 5, Still Op may able find the number of records he retrieve from a database
Manfred Rudolf Bihy 15-Mar-11 9:30am    
Please Albin, I'm going on his own statement that this can't be done. I just gave him a small example in logical reasoning. I think he'll get the drift, if you know what I mean :)
fjdiewornncalwe 15-Mar-11 9:32am    
When the OP builds his table contents, there must be a query or some king of object list behind it.
He'll have to create a sorter of some kind. If it is SQL based, then a simple ORDER BY clause may do the job, but I think there is something missing in the information he has provided that is keeping us from giving a definitive answer to this one.
Manfred Rudolf Bihy 15-Mar-11 9:34am    
Of course Marcus, see my comment on Albin's comment. I just took OP by his word that the total count is unknown and then "proved" to OP if that were true it would be impossible to count backwards to one. A little experiment in logical reasoning won't hurt OP I'm pretty sure.
Albin Abel 15-Mar-11 13:13pm    
:)

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