Best way for refresh only one record in the readonly binding grid

Posts   
 
    
Posts: 15
Joined: 02-Jan-2010
# Posted on: 03-Jan-2010 14:46:21   

Hi, c# 2008 , DevExpress Grid, Winforms mdi, LLBLGEN 2.6 Pro Eval, adapter

I'm binding data to grid with TypedView, DynamicList or LINQ to LLBLGen with LinqServermodeSource. Which is the best way for refresh only one record in the binding grid? The record must be added, modified, append with another mdi form.

Is it not possible can I refresh only one record in the binding grid, I must refresh all record.

Plase send me some example code.

Regards,

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 04-Jan-2010 02:08:18   

I worked something like time months ago. What I did is that my MDI child forms return the adedd/modified/deleted entity, then I insert/update/remove the childs from my main collection by code. It's not ideal, but if you just want per-record basis refresh, this works. It of course depends on how are you binding or calling your child mdi forms, Could you please elaborate more on that? Do you have some tiny repro solution?

David Elizondo | LLBLGen Support Team
Posts: 15
Joined: 02-Jan-2010
# Posted on: 04-Jan-2010 08:26:43   

Hi, Thank yo answer, I worked Delphi win32 and IdeaBlade Devforce Classic (.Net). When I working Devforce project, I can binding SQL View Table to grid.
Devforce support refetch one record on binding grid.

But I dont know how can I refresh only one record with LLBLGEN. Please help me and send me sample project?

Regards,

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 04-Jan-2010 08:58:03   

As David told you, you can return the modified or new entity from the child Form to the main one. Then update the Grid's underlying collection with this entity.

Posts: 15
Joined: 02-Jan-2010
# Posted on: 04-Jan-2010 09:41:43   

Yes I know, but I'm binding data to grid with TypedView, DynamicList or LINQ to LLBLGen with LinqServermodeSource. I want using three methot for binding grid. This is a performance isue for large data.

Regards,

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 04-Jan-2010 09:45:14   

You can still update the Row of data within the DynamicList of TypedView (both are derived from DataTable). And it depends on what structure you fetch the data in using Linq, you can do the same thing.

Posts: 15
Joined: 02-Jan-2010
# Posted on: 04-Jan-2010 10:33:47   

Thank you for answer, please send me some example code?

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 04-Jan-2010 15:25:50   

You can find a DataRow inisde a DataTable using a unique column's value (PK value).

I don't know exactly what you have been trying, so please post what you have tried so far, so we can help you better.

Posts: 15
Joined: 02-Jan-2010
# Posted on: 04-Jan-2010 20:45:23   

Hi;

I am sorry, in other words How can I refetch only as known one record? For Example Customer.ID = 11 object reload from database and refresh in the display grid.

Regards,

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 05-Jan-2010 04:38:07   

You can fetch it again, as follow:

//obtain myCustomer from the grid or the involved collection... 

// fetch it again
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
     adapter.FetchEntity(myCustomer);
}

// remove the old entity from you collection/grind, then add myCustomer
David Elizondo | LLBLGen Support Team
Posts: 15
Joined: 02-Jan-2010
# Posted on: 05-Jan-2010 13:19:00   

Thank you for answer, but I dont know how I can fetched only one record from Typed View.

The follwing code getched all data from Typed View.

using (DataAccessAdapter adapter = new DataAccessAdapter()) { ViewHpTypedView HPView = new ViewHpTypedView(); adapter.FetchTypedView(HPView.GetFieldsInfo(), HPView); return HPView; }

But I want only one record fetched from view to database for refresh binding grid.

and How I can refetch or fetch record from Typed View as using Primary Key? Can I setting PK for Typed View?
for example CustomerEntity customer = new CustomerEntity(); customer.FetchUsingPK("CHOPS");

Regards

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 05-Jan-2010 21:28:27   

To fetch only one row from a typed list you need to provide a filter as part of RelationPredicateBucket object - see the documentation for how to do this.

I'm not sure this helps in your case though as I don't know if it is easy to replace a row in your existing TypedList (the one bound to the grid) with the one you have just fetched. I think our earlier examples assumed you were using an entity collection rather than a list.

Is there any reason why you cannot fetch the whole list again - this is fairly standard practice and the performance overhead is not usually a problem.

Matt