0

Hi.

I am trying to build simple web application in ASP.NET.
I have xml file with data and xsl file to transform xml file into html doc which will be presented in the browser window and everything is working fine.
What funcionallity do I want?
I want user to enter some text into textboxes and I want this data to be saved into source xml file by clicking for example Save button - I think that it is reversion of transformation process (from html into xml). Can I do something like that? Is it hard to achieve?

regards

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by __avd
0

>Can I do something like that? Is it hard to achieve?
Yes you do that using methods of DataSet class and it is very easy.

string file=MapPath("~/text.xml");
  DataSet ds = new DataSet();
  DataTable dt = null; 
  if (!System.IO.File.Exists(file))
            {
                // Create an instance of DataTable
                dt = new DataTable("Test");
                dt.Columns.Add("foo");
                dt.Columns.Add("bar");
                ds.Tables.Add(dt);
            }
            else
            {
                ds.ReadXml(file);
                dt = ds.Tables["Test"];
            }
   dt.Rows.Add("value1", "value2");
   ds.WriteXml(file);
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.