Click here to Skip to main content
16,004,854 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i am facing some problem in SharePoint 2010,

Whether it is possible to add a list items at top, (ie)whenever we adding a list item it have to update at the top of the list...

Please share your answers... Thanks in Advance....
Posted

So, If I understand your problem correctly, you have a list of say 10 items with IDs 1 to 10. Now you want to add an item to the list which in turn should replace the values of item at ID=1. Is that what you are looking for ? Which means you are replacing the first item with the latest added entry. Also it means that you will only have 10 items at all times and the total count will not increase in the list as the values will keep replacing.

IS that what you are after? If yes, I have a solution, if NOT, I am sorry. You can try explaining the problem in more details.
 
Share this answer
 
Comments
Vasanth Vellaisami 20-Feb-13 22:56pm    
Thanks for Spending your valuable Time for reply... You are partially correct... Whenever we adding a list items it have to updated at top of the list... For Example I am trying to add a Student Name on Student List which already having 3 items 1.)John,2.)Tony,3.)Vasanth... After i added the 1 Item(Chandru) the list have to be look like as follows 1.)Chandru, 2.)John, 3.) Tony 4.) Vasanth. Hope Now u Better Understood of my query :)
AnandSharmaUK 21-Feb-13 4:43am    
Seems to me like you want to have the last added student at ID=1. If thats the case, you have to do a foreach loop and re-assign the IDs for all the items. So if there are 4 items in the list and you add a new item, replace(update) the item with the newly added value and do the same for all the items. You can use custom workflow or event receiver to achieve this. It doesn't sound the best solution to me but let me know if you want the code for doing this. Hope this helps.
Vasanth Vellaisami 21-Feb-13 23:20pm    
Hi.. Thanks again for ur reply... It will helpful for me... If u have the code part for achieving this means share with me...
AnandSharmaUK 22-Feb-13 5:55am    
Sure, I can do that. Can you tell me how do you want to deal with the deletion scenario. What happens when you delete any item, how you going to handle that missed item ID which will be deleted?
Also, it will be good for you to write your business scenario if you want an efficient solution. I still do not understand the need of what you are asking. Thanks.
Vasanth Vellaisami 25-Feb-13 4:29am    
Hi... Thanks for spedning ur valuable time for me.. No need to delete any item from the list... if i try to add one element to the list containing 10 elements it have to be added in the top of the list (ie) as a 1'st Element.. so totally 11 elements, Again i try to add another element it have to be added at the top of the list... Now its totally 12 elements... Hope Now you understand my query... If u have any further doubt i am ready to send screenshots... thanking you...
If I understand your problem correctly, you want to see the latest added item at the top of the list. If that is what you want, you can create a view/edit the default view and sort it DESCENDING on the created date.

If that's not you are looking, can you explain your question bit more please?
 
Share this answer
 
Comments
Vasanth Vellaisami 18-Feb-13 23:40pm    
Thanks for ur reply... It's not like that... Whenever we adding a list item in the list it will be updated at last row of the list instead of that it have to be update @ first row of the list... It like (Last In First Out in Stack)

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