D
dSchwartz
I need help adding a column to a dataset, but its a little bit more
complicated then just that. Here's the situation: I have many xml
files in one directory, each which represent a newsletter. I want to
create a page that will display a title and date of each newsletter,
along with a link to it. here's a code snip:
=============================
DirectoryInfo dirInfo = new
DirectoryInfo(Server.MapPath("/newsletters/xml/"));
FileInfo[] newsletters = dirInfo.GetFiles("*.xml");
DataSet objDataSet = new DataSet();
string strVirtualPath = "";
foreach (FileInfo xfile in newsletters)
{ strVirtualPath = "/smartmail/xml/" + xfile;
objDataSet.ReadXml(Request.MapPath(strVirtualPath));
articleList.DataSource = objDataSet.Tables;
articleList.DataBind();
DataView objDataView = new DataView(objDataSet.Tables[0]);
objDataView.Sort = "title";
articleValues.DataSource = objDataView;
articleValues.DataBind();
}
=================================
this produces a table (bound to datagrid) with one row for each xml
file. the columns are newsletter_ID, title, and date, which is good,
but i want to add a column that will contain the actual filename of
the xml file. How could this be accomplished?
Thanks for your time!
I don't think it will be needed to help me, but just in case, here is
a sample of the xml files:
=======================================
<?xml version="1.0" encoding="UTF-8"?>
<newsletter title="newsletter title" date="28 Feb 2004">
<article>
<title>specific article title</title>
<author>DJS</author>
<date>Jan 6 2004</date>
<body>specific article text here.</body>
</article>
<article>
.....
</article>
</newsletter>
========================================
complicated then just that. Here's the situation: I have many xml
files in one directory, each which represent a newsletter. I want to
create a page that will display a title and date of each newsletter,
along with a link to it. here's a code snip:
=============================
DirectoryInfo dirInfo = new
DirectoryInfo(Server.MapPath("/newsletters/xml/"));
FileInfo[] newsletters = dirInfo.GetFiles("*.xml");
DataSet objDataSet = new DataSet();
string strVirtualPath = "";
foreach (FileInfo xfile in newsletters)
{ strVirtualPath = "/smartmail/xml/" + xfile;
objDataSet.ReadXml(Request.MapPath(strVirtualPath));
articleList.DataSource = objDataSet.Tables;
articleList.DataBind();
DataView objDataView = new DataView(objDataSet.Tables[0]);
objDataView.Sort = "title";
articleValues.DataSource = objDataView;
articleValues.DataBind();
}
=================================
this produces a table (bound to datagrid) with one row for each xml
file. the columns are newsletter_ID, title, and date, which is good,
but i want to add a column that will contain the actual filename of
the xml file. How could this be accomplished?
Thanks for your time!
I don't think it will be needed to help me, but just in case, here is
a sample of the xml files:
=======================================
<?xml version="1.0" encoding="UTF-8"?>
<newsletter title="newsletter title" date="28 Feb 2004">
<article>
<title>specific article title</title>
<author>DJS</author>
<date>Jan 6 2004</date>
<body>specific article text here.</body>
</article>
<article>
.....
</article>
</newsletter>
========================================