public void AddProductCategory(string filePath, string productCategory)
{
XDocument oXDoc;
try
{
if (File.Exists(filePath))
{
oXDoc = XDocument.Load(filePath);
oXDoc.Element("DataContent").Add(
new XElement("Data",
new XElement("ID", Guid.NewGuid().ToString()),
new XElement("CategoryName", productCategory)
));
oXDoc.Save(filePath);
}
else
{
XElement oXElmnt = new XElement("DataContent",
new XElement("Data",
new XElement("ID", Guid.NewGuid().ToString()),
new XElement("CategoryName", productCategory)
));
oXElmnt.Save(filePath);
}
}
catch (Exception ex) { }
}
Wednesday, April 27, 2011
Subscribe to:
Posts (Atom)
Motivational qoutes
पूरे विश्वास के साथ अपने सपनों की तरफ बढ़ें। वही ज़िन्दगी जियें जिसकी कल्पना आपने की है।
-
H ere is the code example given to add Image column in Datagrid control dynamically at run time in WPF. public void AddColumnsToDataGrid(...
-
S ome times we need to add some controls in a container at run time. Here is the coding logic given to add CheckBox column in Datagrid cont...
-
H ow to add TreeViewItem dynamically in TreeView control in WPF. Here is the coding example given below to add TreeViewItem in TreeView con...