winform 2005 datagridView (in-line editing)

Posts   
 
    
yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 14-Feb-2006 11:51:58   

version 1.0.2005.1 final (self-servicing) VS2005 winforms


hiya,

I need to perform some inline editing of a winform 2005 datagridView. Only one of the columns is readWrite.

Q#1 That said, I assume I still have to use an entityCollection? Q#1

I have been used to the useful RAD in winforms 2005, where I simply:

1) catch the cell_End_Edit event 2) call the dataAdapter UPDATE method, and that's it.

I am looking to do similar with a datagriDView that is bound to an llblGenPro entityCollection.

Q#2 Can anyone spare a post of the cell_End_Edit event code that they use to update the underlying database? Q#2

You see, I am not sure if I should be grabbing the row that has been changed and using unitOfWork etc.Maybe it is simpler than that, I don't know.

Many thanks,

yogi

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 14-Feb-2006 14:56:39   

Q#1 That said, I assume I still have to use an entityCollection?

EntityCollection is fine to use.

Q#2 Can anyone spare a post of the cell_End_Edit event code that they use to update the underlying database?

If you want to save all the changes in one go, then use the EntityCollection SaveMulti() method and it will do the job.

Else if you want to save row by row (each changed Entity), then you can catch the cell_End_Edit and then either construct your entity and call Save().

I don't prefer the later approacheven if the Entity has one editable field, coz it wouldn't be nice to call the database on this event, since the user might change his mind many times before he finally settle on a value to save, then Saving triggered by a button or a customer decision is a better approach.

yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 14-Feb-2006 15:49:04   

Agreed Walaa.

Ta for the reply.By the way, congratulations on the African Nations Cup :-)

yogi

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 14-Feb-2006 22:04:13   

You are always welcomed.

And thank you for the congratulations. smile

Where are you from so I could congratulate you on a similar occasion?

yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 02-Apr-2006 16:36:02   

i'm from sunny scotland. we never win anything, especially not football.flushed