Deleted State with GridView

Jul 2, 2008 at 2:38 PM
Hello Matt,

I am using WCF services with LINQ to SQL and LINQEntityBase clase and my presentation layer is ASP.NET.

I am working in disconnected mode, I am adding, deleting records from the Gridview that is binded to a session. After I am done I am sending my changes to database.

The problem I am facing is in the deleted records, when I am deleteing the record from the binded list the grid is still showing the record.

What is the best solution of Gridviews in Add, Delete mode with disconnected mode.

Best Regards,
Jul 8, 2008 at 1:53 PM
Hi there,

Sorry for the late reply.

The best way that I have found to do is to keep your entities in session and provide a method on a class to handle each of the Select, Insert, Delete and Update events/methods seperately.  Note that from memory, you'll need to provide an instance of the class by overriding an object context event, so that ASP.NET doesn't create a new object on every call - so you can keep state.  With the select method, you just need to make sure that you are only returning those records where the LINQEntityState != EntityState.Deleted.

Hope this makes sense.