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

Unable to save user inputs into the grid

So I'm trying to learn the basics of the DataGrid and I have hit a little bit of a barrier. So I have successfully made a grid and it worked perfectly but I decided I would like to make it so a user could edit a cell and change its contents. So I added AllowEditing="True" to the SfDataGrid and it allowed me to change inputs on the grid but when I go back a page and then back to the grid page it hasn't kept the changes.

So basically I'm after a way so that when a user changes a cell it is saved so next time the page opens it has the updated grid.
I followed Syncfuisions video on Datagrid (https://www.youtube.com/watch?v=rdPStxCSy5w&t=139s) so my code is pretty much that but I have added in AllowEditing.

Just trying to learn it all so would be great if someone could explain how to get user inputs to save.

1 Reply

BS Balasubramani Sundaram Syncfusion Team October 17, 2019 11:44 AM UTC

Hi Tom,    
Thanks for contacting Syncfusion support.     
Your requirement to have a common view model for all page to maintain the data to perform CRUD operation can be achieved by using the static view model to access it anywhere in your application without updating when navigation to another page.  
Please refer the below sample and code snippet.  
Code Snippet [C#]   
public App()   
    MainViewModel._ViewModel = new ViewModel();   
public static class MainViewModel   
    public static ViewModel _ViewModel { getset; }   
    <x:Binding Source="{x:Static local:MainViewModel._ViewModel}"/>   
Please let us know, if you require further other assistance from us.   
Balasubramani Sundaram 

Live Chat Icon For mobile
Up arrow icon