Reputation: 1
I am trying to write code to read and write the XML but I am facing some errors, Could please someone provide the sample code to read XML in grid and can update/insert data from grid which will be saved in following sample xml file.
Sample XML file:
I am facing the below exception: The assembly with display name '...XmlSerializers' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly '.....XmlSerializers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Upvotes: 0
Views: 280
Reputation: 95
to load xml data onto a grid you should use DataSet. convert XML data into dataset and load it on to the grid view i think this should work
//Method for serialization. Just In case if you went wrong some where
public static string SerializeElement(object transactiondetails)
{
XmlSerializer ser = new XmlSerializer(typeof(transactions));
StringWriter sww = new StringWriter();
XmlWriter writer1 = XmlWriter.Create(sww);
ser.Serialize(writer1, transactiondetails);
writer1.Close();
return sww.ToString();
}
Upvotes: 1