Controls You Can Use on Web Forms ASP.NET Standard Controls Xml Control
Essentially, to create a working Xml control, you need to add the control to the page and bind the control to a data source.
- Declare an <
asp:Xml
> element into the page. For syntax, see Xml Control Syntax.
- Load the XML data that you want to display into the control by setting the Document or DocumentSource property, or by putting the XML between the control’s opening and closing tags. For details, see Loading XML Data in the Xml Control.
- Create an instance of the control and set its properties:
Xml myXML = new Xml ( );
myXML.DocumentSource = "SourceDoc.xml";
myXML.TransformSource = "SourceTrans.xsl";
Dim myXML As Xml = New Xml ( )
myXML.DocumentSource = "SourceDoc.xml"
myXML.TransformSource = "SourceTrans.xsl" |
|
C# |
VB |
- Add the new control to the Controls collection of a container already on the page:
PlaceHolder1.Controls.Add ( myXML );
PlaceHolder1.Controls.Add ( myXML ) |
|
C# |
VB |
NOTE: 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 Introduction to Web Forms State Management.
Introduction to the Xml Control Loading XML Data in the Xml Control