We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

update()


Hi,

Thanks for all the great help and responses! It's definitely making my coding life much more efficient. =)

I've been trying to use databoundgrid.update() to save changes I've made to the table, but when I reload the table, the old values are still there. I think I am not using the function correctly.

Any help would be greatly appreciated. Thanks!

8 Replies

HA haneefm Syncfusion Team June 29, 2007 03:00 PM UTC

Hi Code12345,

Before reloading your datatable, call grid.Binder.SuspendBinding and then call grid.Binder.ResumeBinding afterwards. You can also call grid.BeginUpdate before, and grid.EndUpdate afterwards (possible followed by grid.Refresh()). Try resetting the datasource with the following code to see if that helps:

this.grid.CurrentCell.Deactivate(true);
this.grid.Binder.GridBoundColumns.Clear();
this.grid.Binder.InternalColumns.Clear();
this.grid.Binder.SuspendBinding();
this.grid.BeginUpdate();
this.grid.DataSource =null;
this.grid.DataMember = "";
this.grid.Model.ResetVolatileData();
this.grid.DataSource = newTables;
this.grid.EndUpdate(true);
this.grid.Binder.ResumeBinding();
this.grid.Refresh();

See the below forum thread for more details.
http://www.syncfusion.com/support/forums/message.aspx?&MessageID=28170

Best regards,
Haneef


JO John July 3, 2007 08:25 PM UTC

Hi,

I tried copying and pasting the example code that was provided in the message, but the grid is still not saving the new rows to the database. Are there any additional steps that I need to take? Thanks!


HA haneefm Syncfusion Team July 4, 2007 11:03 PM UTC

Hi Code12345,

Please try to provide us some more information on this issue. I tried to reproduce the issue, but couldn't. kindly provide us a minimal sample to reproduce the issue or modify any of our browser sample accordingly. This will help us to analyse the issue further.

Best regards,
Haneef


JO John July 5, 2007 10:04 PM UTC

Hi,

Here is sample code from VS2005. You can ignore everything but the load and save buttons at the top. (You will probably need to set your own connection string and SQL Select Statement.)

Steps to reproduce the problem:

1. Press the Load Button to load a table into the databoundgrid.

2. Change the contents of any cell in the grid.

3. Press the 'Save' button.

4. Press the Load Button again and see that the contents of the cell that was changed reverts back to its original value.



SyncfusionTesting.zip


HA haneefm Syncfusion Team July 6, 2007 06:28 PM UTC

Hi Coder12345,

Thank you for posting your query to us.

I am afraid that i was not able to reproduce the issue in your sample. Also i have created a simple sample to test this issue and it is available in the following link,.

GridHierarchy.zip

Please have a look at the above sample and if still the issue exists, could you please try reproducing it in the above sample or send us the reproducing steps that we could sort out the cause of the issue and provide you a solution?

Best regards,
Haneef


JO John July 6, 2007 09:52 PM UTC


Hi Haneef,

Thanks for providing me with the code sample. I will take a look at it right now.

Can I just confirm that the code that I provided actually worked on your lab computer or did it just not work at all? Please let me know so that I can determine if I might have a problem with my computer's configuration or properties.

Thanks!


JO John July 6, 2007 10:05 PM UTC


Hi Haneef,

I think I might know what's going on now...

Can you explain to me the difference in functionality between the update and the save buttons? Thanks!



HA haneefm Syncfusion Team July 6, 2007 10:47 PM UTC

Hi Code12345,

Thank you for your update.

Can I just confirm that the code that I provided actually worked on your lab computer or did it just not work at all?
>>>>>>>>>>>>>>>>>>>>>>>
I have tested this problem by changing the sqlconnection and table name in your above attached sample.Your attached sample working fine without any issue. Below is your modified sample.

Sample :SyncfusionTesting.zip

Can you explain to me the difference in functionality between the update and the save buttons?
>>>>>>>>>>>>>>>>>>>>>>>
Regarding Update Button:
It updates the underlying datasource changes into sql database.
Regarding Save Button:
It resets the underlying datasource with new one(modified datasource).

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon