Click here to Skip to main content
15,921,577 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing an application where I am fetching data from xml file and displaying this to datagrid view in wpf. And I have given a option to add or change row at run time. But the problem I am getting is what that whenever I add a new row to the gridview and press enter key it show that the file has been changed message but in fact it does not do anything to the xml file bot the most important thing is to notice that when again I add a row to the gridview it writes the earlier row to the xml file. But I need to add that row at the same time. Please help me.

code is like this:
private void button1_Click(object sender, RoutedEventArgs e)
       {
           ds.ReadXml("c:\\new.xml");
           dataGrid1.DataContext = ds.Tables[0].DefaultView;




       }

       private void dataGrid1_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e)
       {
           ds.WriteXml("c:\\new.xml");
           MessageBox.Show("Row is added successfully.");



       }
Posted
Updated 12-Mar-13 7:40am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900