Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 24th, 2007, 09:13 AM
Registered User
 
Join Date: Apr 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Move Datagrid rows

I need to give my users the option of reordering individual rows in a datagrid. They should be able to move one row up or down in the Datagrid with the change in positioning saved back to the database via an ID field.

I'm completely stumped on how to begin this. Does anyone have any suggestions or sample code? This project is using VB.NET.

Thanks in advance for any help!
 
Old April 24th, 2007, 05:31 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

OK. Here's a start. First I have an OrderID column in the database. When I post the datagrid I have a template column that puts images of up and down arrows in the column. The top selection does not have an up arros and the last row does not have a down arrow. I have functions OrderUp and OrderDown that reorder the OrderID's for the selected row and either adding or subtracting one to the OrderID and either subtracting or adding one to either the row above or row below depending on whether you're moving up or down.

There are other alternate ways of doing this depending on your exact requirements.






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to move rows in a table bucky483 Javascript How-To 10 March 27th, 2017 12:57 AM
move next rows in DataGrid < > prop. not correct fbailey ASP.NET 1.0 and 1.1 Basics 3 September 5th, 2007 10:17 AM
Moving rows up and Down in Datagrid Baby_programmer ASP.NET 1.0 and 1.1 Professional 5 August 20th, 2006 04:14 AM
rows in Datagrid drachx General .NET 0 October 20th, 2004 08:02 PM
move rows to top with cells in columnA filled RED alienscript Excel VBA 2 December 2nd, 2003 12:51 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.