Swapping items in a list is not a trivial thing to do. Here's what I would do (pseudo code)
1. Add a SortOrder column to your database and Business Object.
2. Bind the list and display up / down arrows.
3. When one of the items is clicked find the "other item". E.g. the one above when the Up arrow is clicked or the one below with the Down arrow.
4. For both items, get its unique ID. You can use the clicked item's index in the Grid, then add or subtract one from that index to find the other and then use the DataKeys collection to find the unique IDs.
5. Fetch both items using something like GetItem
6. Swap the sort order for both items using a temp variable. E.g.
tempSortOrder = a.SortOrder;
a.SortOrder = b.SortOrder;
b.SortOrder = tempSortOrder;
That should swap the items and update them in the database.
I have no idea what you mean with your other question. I don't understand "i need to do a gridview.datasource ans gridview.databind in the event handlers..!" and "Right now I m storing it in Session during first load and using it the the paging/sorting event handlers.." so I can't recommend "any better way of doing this"
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results
and Beginning Dreamweaver MX / MX 2004