How to: Add XML Web Server Controls to a Web Forms Page
AddWeb server controls to the place in the page where you want the output to appear.
To add an XML Web server control to a Web Forms page
Type an <asp:XML> element into the page. For syntax, see XML Web Server Control.
Load the XML data that you want to display into the control by setting the Loading XML Data in the XML Web Server Control.or property, or by putting the XML between the control's opening and closing tags. For details, see
You need to be sure that when your application runs, it has sufficient permissions to read the XML file.
To add a control to a Web Forms page programmatically
Create an instance of the control and set its properties:
Dim myXML As System.Web.UI.WebControls.Xml = _ New System.Web.UI.WebControls.Xml() myXML.DocumentSource = "SourceDoc.xml" myXML.TransformSource = "SourceTrans.xsl"
Add the new control to the Controls collection of a container already on the page:
Controls that you add dynamically to a Web Forms page do not automatically become part of the page's view state — neither the controls nor their values are saved when a page performs a round trip to the server. You are therefore responsible for saving the state of any dynamically generated controls whose values you want to preserve. For details, see.