How to: Add XML Web Server Controls to a Web Forms Page (Visual Studio)
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
From the Standard tab of the Toolbox, drag ancontrol onto the page.
Load the XML data that you want to display into the control by setting theor property, or by putting the XML between the control's opening and closing tags. For details, see .
Make sure that when your application runs, it has the appropriate permissions to read the XML file. For details, see.
To add an XML Web server control to a Web Forms page programmatically
Create an instance of the Xml control and set its properties, as shown in the following code example:
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 that is already on the page, as shown in the following code example:
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.