I am using AutoCRUD functionality.I have created a couple of SQLDataSource with Insert, Update and Delete auto geerated, they are then used as relational tables in a WebHierarchicalDataSource Which then is used to link to the grid; the data is loaded correctly, I can add a new row correctly and I can delete a row by selecting it.The problem is when I want to edit the row when I double click a cell it goes in the edit mode and allows me to type the text in (change the text), then I hit the enter button to confirm the changes. This doesn't updates the database right a way, even if I select another row the changes text is displyed in the grid but not updated in the database, Now if I do some other thing like expand collapse the child rows then the data is updated in the database.
I am now clueless what triggers the update in the database? is there any seetings required?
I tried setting the Edit Grid Baviour -> Activation -> AutoPostBackFlags -> ActiveCellChanged -> True, but this doesn't work either. Pease help me how can I make this work. I also made sure that the bands have the DataKeyFields poperty correctly set. Please help.
thanks
D
Hi,
This is a bit of a hassle in the WDG and WHDG. Any postback will update your datasources. Ajax postbacks of the grid will also update the datasources. That's the easiest way. The other way is to handle some of the client side events on leaving edit mode or leaving the row and then forcing the postback yourself with something like:
grid.get_behaviors().get_editingCore().commit();
Then, you might run into the problem that many of us have that the above line doesn't cause the postback like they (Infragistics forum people) say it should. There's at least 5 or 6 posts complaining about it, but I don't know of a response.
I hope this will be helpful,
Ed
Thanks for the reply,
Is there a more sure way to update the database, I mean I don't mind putting a SAVE button on the page that the user have to click to update the database with all the changes in the grid.
If so, what should be the code behind for the SAVE button click event?
from what I understand this can be done by javascript as you mentioned byt calling
but there is not for sure that this will work.
thanks ed,
yeah adding a SAVE button just to trigger a post back seems to be working. It updates the databse all the time and it seems consistent.
The save button idea should work. You wouldn't need to put any code into it at all. Instead of using the commit(), you could probably put the save button into an updatepanel so that the postback will be an ajax call. I've never tried that so I'm not sure. You would get the same functionality as the commit(). Of course, we would wish that someone could tell us why the commit() is not working.