Home Forums WPF controls Xceed DataGrid for WPF How to save rows edited

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #25501 |

    Hi,

    I’m triying to save files modified by the user
    to my database,
    the problem is that on
    saveRowsModified() the ArticlesGrid.Items
    doesn’t contains the changes made by the user on
    the datagrid.

    can anyone help me, please?

    This is my example:

    Page1.xaml

    <Grid.ColumnDefinitions>
    <ColumnDefinition Width=”*” />
    </Grid.ColumnDefinitions>
    <Grid Margin=”0,229.862,0,75.5″>
    <Grid.Resources>
    <xcdg:DataGridCollectionViewSource x:Name=”ArticlesGridCollectionViewSource” x:Key=”cvs_orders” />
    </Grid.Resources>
    <xcdg:DataGridControl x:Name=”ArticlesGrid” />
    </Grid>

    <Button Margin=”0,0,86,48.5″ Name=”btnSave” Content=”Save Rows” HorizontalAlignment=”Right” VerticalAlignment=”Bottom” Width=”159″ Height=”23″ ClickMode=”Press” Click=”saveRowsModified”/>

    Page1.xaml.cs

    public Page1()
    {
    InitializeComponent();
    ArticulosGrid.ItemsSource = listArticles;//listArticles contains a collection from my database.
    }

    public void saveRowsModified(object sender,
    RoutedEventArgs e)
    {
    foreach (object item in ArticulesGrid.Items)
    {
    string myField = ((myRow) item).myField;
    //Save field on my Database
    }

    }

    Imported from legacy forums. Posted by Alma (had 2109 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi
    I don’t know what u r doing is right or wrong but one reason i can figure it out that y it is not working is because in ur XAML ur grig name is “ArticlesGrid” while in code behind u r referencing it as “ArticulesGrid”………

    Imported from legacy forums. Posted by Saurabh (had 774 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.