01.
string
folderPath =
"c:/inetpub/wwwroot/xml"
;
02.
DirectoryInfo xmlFolder =
new
DirectoryInfo(folderPath);
03.
FileInfo[] xmlFiles = xmlFolder.GetFiles(
"*.xml"
);
04.
DataTable dataSource =
new
DataTable();
05.
bool
firstLoop =
true
;
06.
07.
foreach
(FileInfo aXmlFile
in
xmlFiles)
08.
{
09.
DataTable dataTemp =
new
DataTable();
10.
string
filePath =
string
.Format(
"{0}/{1}"
, folderPath, aXmlFile.Name);
11.
12.
dataTemp.ReadXml(fileName);
13.
14.
if
(firstLoop) dataSource = dataTemp.Clone();
15.
16.
dataSource.Merge(dataTemp);
17.
18.
firstLoop =
false
;
19.
}
20.
21.
GridView1.DataSource = DataSource;
22.
GridView1.DataBind();