Print Page | Close Window

Data binding a SortSequence property to a grid?

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1348
Printed Date: 27-Apr-2025 at 7:37am


Topic: Data binding a SortSequence property to a grid?
Posted By: aschaff
Subject: Data binding a SortSequence property to a grid?
Date Posted: 25-Jun-2009 at 3:10pm

Hello. I have a unique challenge. I want to use an XtraGrid to allow users to create and modify Favorite entities. Favorite is an entity that contains a Name and a SortSequence property. I would like the user to enter the name, but then I would like the SortSequence property to automatically match the order of the row in the grid. In other words, if the user enters 5 items in the grid, I want SortSequence to be 1 for the first row, 2 for the second row, and so forth. If the user delets the third row in the grid, I want the Favorite entity with SortSequence 4 to change to 3 (moving up the favorites list now that the 3rd one is gone). Likewise 5 should change to 4 and so forth.

I hope I am explaining this well. I can bind a list of Favorite entities to an XtraGrid using the XtraGridBindingManager just fine. But I have no idea how to go about binding the SortSequence property to the row number of the grid so that when I delete/insert/move grid rows, the bound entities renumber their SortSequence appropriately.

Can anyone offer advice on how to do this? Obviously, if there is a way to data bind the SortSequence property I would be ecstatic, but I'm open to other creative work arounds if necessary.

-AJ



Print Page | Close Window