Refresh a single row of a TypedList

Posts   
 
    
mds avatar
mds
User
Posts: 33
Joined: 24-Sep-2006
# Posted on: 02-Oct-2006 23:30:40   

I'm using VS2005 and Selfservicing template for developing a windows application, i have a datagridview binded to a TypedList that shows some data from three db table, it contains about 2000 record. When I doubleclick a row, by a modal form the user can change some value (related to only one table/entity ) and save them in the DB. When the form closed i'd like to update the value displayed on the grid.

Since theTypedList is readonly I can't change directly the sigle datarow, and I won't refetch again all the data with fill method or use LoadDataRow method (the new line is added at the end of the list). The only method I have found is to set the readonly property of interested datacolumn in TypedList to false and then update each field with new value...

Is there a more direct method ?

Thanks in advance (sorry for my english confused ).

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 03-Oct-2006 03:03:09   

Well the best response I can think of would be to use entity collections with prefetch paths. This would allow you to make changes and save them while keeping the GUI updated. The typedlist is meant to be read-only and usually the preferred way to update a typedlist bound control is to rebind it.

Jessynoo avatar
Jessynoo
Support Team
Posts: 296
Joined: 19-Aug-2004
# Posted on: 03-Oct-2006 16:11:35   

If you want to keep your flat view of the 3 tables, you can also create a concrete view in your db, and map it to an entity in the designer, which should ease the binding process. Otherwise, you need to handle the binding events manually to flatten the tree structure of the prefetch in your grid.

Cheers

mds avatar
mds
User
Posts: 33
Joined: 24-Sep-2006
# Posted on: 03-Oct-2006 18:12:48   

With the solution proposed by bclubb i lost the flexibility of build my view in LBLLGen Designer, I have to write a prefetch path in code. (I will deepen the prefetch path use)

The solution proposed by Jessynoo is not for my case because the view structure can change frequently, so I _ need to handle the binding events manually_...

To force the updating of a TypedList row i must set the readonly property of relative column to false...Are there any contraindications to this ?

Thanks for your replay!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 03-Oct-2006 18:52:32   

No you can set it to false if you like. They're set to readonly because a typedlist should be threated as a readonly datatable.

Frans Bouma | Lead developer LLBLGen Pro