In a new class I'm writing, I need to take the contents of an external XML data feed and convert it into an HTML table via C# and .NET 2.0 (cannot go any higher due to server constraints). Since we reuse the code, I'm putting this functionality into a class. Here is the XML Loader class:
using System;
using System.Web;
using System.Data;
using System.Text;
using System.Diagnostics;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
namespace
{
public partial class XMLLoader
{
private String xmlpath = "\\xml\\data_test.xml";
public String getXMLData()
{
DataSet dsXMLData = new DataSet("xml_data");
string filePath = xmlpath;
dsXMLData.ReadXml(filePath);
Debug.WriteLine(dsXMLData.GetXml());
DataGrid DataGrid1 = new DataGrid();
DataGrid1.AllowPaging = true;
DataGrid1.DataSource = dsXMLData;
DataGrid1.DataMember = "xml_data";
StringBuilder outStr = new StringBuilder(String.Empty);
outStr.Append(dsXMLData.GetXml());
return outStr.ToString();
}
}
}
Where I am getting stuck is outputting the contents of the data grid to an HTML Table using the outStr var which I am simply writing to the APSX page using <% Response.Write(); %>. Either way I'm stuck and so far not finding what I want to display in MSDN.