Doubt in New Record

Doubt in New Record

Old forum URL: forums.lhotka.net/forums/t/8079.aspx


alagesan posted on Wednesday, December 02, 2009

hi.,
iam using CSLA 3.5.dll,iam displaying list of customers in GridView control
when i click in new record row in GridView control ,its creating new row
(its calling AddNewCore method then new objectCreated)

but when i move from that row without modifying anything the row is not deleted
its still there
when iam saving its also going to save
but i dont want save that

can any one give me solution?
iam using BussinessListbase and bessinessBase classes

for CustomerList and Customer Classes


rsbaker0 replied on Wednesday, December 02, 2009

I don't think automatic removal of child objects added to BusinessListBase via a grid is built into CSLA.

Also, BusinessListBase doesn't automatically save -- you have to call Save() yourself. If you want the grid to automatically save the objects, then you need to use an EditableRootListBase derived class (which still is not going to delete the unmodified row).

I'm not familiar with the GridView control, but the grid in the control suite I use (DevExpress) does not call AddNew on the bound list until you actually type or select a new value on the new record row.

RockfordLhotka replied on Thursday, December 03, 2009

CSLA does automatically remove a new item from the grid - if the grid interacts with data binding correctly.

Typically the user needs to press ESC to cancel the new row, and that will remove it from the datagrid. But different datagrid controls work in different ways.

CSLA doesn't really care about the datagrid - it cares that the UI calls the right data binding methods to trigger the correct behavior.

rsbaker0 replied on Thursday, December 03, 2009

RockfordLhotka:

CSLA does automatically remove a new item from the grid - if the grid interacts with data binding correctly.


Typically the user needs to press ESC to cancel the new row, and that will remove it from the datagrid. But different datagrid controls work in different ways.



CSLA will remove a new item from a BLB or ERLB just because you navigated to another row? How is this done?

(Of course it makes sense that pressing Esc or some similar key implemented by the grid for explicitly cancelling the edit should work properly)

Copyright (c) Marimer LLC