Wednesday, January 28, 2009

Binding XML to GridView in .NET

1) xmlDataSource control.
- Add xmlDataSource control to ASP, with ID
- Codebehind: Add method "data" to control.
- Data might need method
- May need method TransformFile (for xsl)
- Add method Databind()

- Instantiate a Dataset
- Use Dataset.ReadXML method. Pass Request.PhysicalApplicationPath + "File.xml"
- Set Gridview's Datasource to be dataset.
- May set GridView GridView1.DataMember to a node.

No comments: