Hi,I have a problem and I can't find any functionality in WinGrid to cover my requirements.Let's start from beginning:I have a WinGrid with numer of products ( I am versioning each product with name of the product and date ). Date is kind of history for me, used for processing and reporting stuff.The idea is that I would like to show only latest information about product ( for latest date ). I can do this and that is fine.My grid looks more or less like this:PRODUCT NAME 1 | DATE 1 (HIDDEN ON GRID) | PRICE 1 | ITEMS 1 | DESCRIPTION 1 PRODUCT NAME 2 | DATE 2 (HIDDEN ON GRID) | PRICE 2 | ITEMS 2 | DESCRIPTION 2 PRODUCT NAME 3 | DATE 3 (HIDDEN ON GRID) | PRICE 3 | ITEMS 1 | DESCRIPTION 3 Product Name and Date is a primary key. We can have multiple entry for the same product with different dates but we will display only latest information for each product.We can create new entry ( for each day ) or update information on the same day when entry has been created.My problem is to hide whole row in WinGrid and replace ( on the same position in the grid ) with new row when we are creating entry for completely new day.If row is updated we have no problem but if we have new row we have to hide existing one and add new one in the same place when old one has been displayed on the WinGrid.There is any possibility to do this ?RegardsPiotrek
Hi Piotrek,
Adding a row to the data source will automatically update the grid and display the new row - assuming that your data source implements IBindingList.
If it does not, then you can tell the grid that the data in the data source has changed by calling the grid.Rows.Refresh(ReloadData) method after you add the new row.
To move the row, you could either do what I suggested above (sort the grid), or else you could use the grid.Rows.Move method to move the row to the position you want.
Hi Mike, I am using an extra field called ACTIVE. Each time when I am modifying or adding new row, existing one (for the product) has been changed to not active. In this way then I am selecting in SQL only active products I got last once. I can handle SQL part (in LINQ2SQL it is easy part) but I do not know how to mange WinGrid :( I want to hide one row and later on add a new one and move to the same position in the grid where the hidden row has been took place. My question is how to hide row on the WinGrid and how to add row to the WinGrid and move to the certain position of the WinGrid to looks like nothing happen from user point of view. Regards Piotrek
How are you handling this now? How do you manage to only show the latest date for each product in the grid? Are you doing this by filtering the rows in the grid's DataSource. Or are you hiding the rows in the grid?
It seems to me that you would need to sort the rows in the grid by product and then by date and then loop through the grid rows to hide all but the first instance of a row for each unique product.