Following is the methods I used to get a simple unformatted grid up and working.
Due to corporate constraints at my current employer, I am forced to use XML and cannot take advantage of the latest JSON technology. That meant that the grid data source has got to be XML.
Exposing XML in ASP.Net is not well documented and not well understood. In fact, I even came across a Jesse Liberty posting asking how to do something similar (I think). (Hat's off to Jesse Liberty - he writes great books - but I have no idea what he is talking about in that post.)
Creating a raw XML page from an ASPX file turns out to not be difficult. Write code to do the following in the Page_Load event:
- Create a DataSet
- Connect to the database and fill a table in the dataset via a DataAdapter
- Create an XmlTextWriter and populate the constructor with the Response.OutputStream and Encoding.UTF8 arguments
- Call the XmlTextWriter.WriteStartDocument() method
- Use the data table.WriteXML method, using the XMLTextWriter as the single argument
- Call the XmlTextWriter.WriteEndDocument() method
- Clear the page of all markup except for the page directive at the top
- Add the ContentType attribute to the directive, specifying "text/xml"
ExtJS Sample code
Finally, do yourself a favor and create a record object to pass the data when using the reader to read the data structure. I'm not sure what they are doing in the example - but hopefully I'll learn. Creating a record object will make your life easier.