C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » ASP.NET/Web Applications »

The Cool asp:xml control for displaying xml data.


Posted Date: 04 Oct 2005    Resource Type: Articles    Category: ASP.NET/Web Applications
Author: Harish RanganathanMember Level: Gold    
Rating: 1 out of 5Points: 10



Introduction


XML is becoming one of the most sought after technologies for storing and retrieving data and particularly for displaying Data on Web Pages.

The cool asp:xml control


How many of us are aware that we can use the server control to just specify the xml file and the xslt or other stylesheet file and then without a single line of code, .net does the transformation for rendering in an aspx page?

For the benefit of those who are not aware, the following is the code for accomplishing the same:-



<asp:Xml id="Xml1" runat="server" DocumentSource="file path to xml file" TransformSource="file path to xslt file">




Put the above code in the aspx page as you would normally declare other server controls like button, label etc., and it will load the document, apply the stylesheet and render it for you, in the aspx page. All done without a single line of additional code.

You can assign the DocumentSource and TransformSource from the codebehind as well like other server controls.

XML from DataSet


If you are using a DataSet and want to assign the xml from the dataset, well you can use the DocumentContent property of the <asp:xml> control to specify the xml format as follows:-


Xml1.DocumentContent = DataSet1.GetXml();


where Xml1 is the id of the <asp:xml> control.

Summary


This article discussed about the asp:xml control for displaying XML Data on ASP.NET Pages.



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Assigning the text value for a Password Textbox
Previous Resource: 10 Code Snippets for ASP.NET Developers
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET/Web Applications


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use