Article
    C#
    ADO.Net
    .NET
    ASP.Net & Web Forms
    Custom Controls
    Web Development
    Exception Handling
    XML
    Database
    Security in .Net
    Testing
    Web Services
    Windows Services
    Windows Controls
    WCF
    AJAX
    WPF
    XAML
    Reporting
    Setup
    VB.Net
    LINQ
    JQuery
    SilverLight
    JavaScript
    HTML5
    Crystal Report
    Cloud Computing
    Share Point
    Visual C++
    MVC
    Android
    PHP
    Java
    HTML
    WordPress
    Joomla
    Products
    Drupal
    Windows Phone
    JSON
    LightSwitch
    iPhone/iPad
    Ruby on Rails
    IIS 7
    Windows 8
    CSS/CSS3
    Excel
    MS Access
    Shortcut Keys
    Visual SourceSafe
    Team Foundation Server
    API(s)
    Sencha-Touch
    Single Page App
    Bootstrap
Follow Us
Follow _MindStick_ on Twitter View MindStick Software's LinkedIn profile View MindStick Software's Facebook profile
Top Contributor
Advertisement
Advertise with Us
Mindstick
Article Article  Forum Forum  Blog Blog  Quiz Quiz  Beginner Beginner  Careers Careers  Contact Contact  Login Login  
Home | Product | Services | About Us | Interview | DeveloperSection | Submit an Article | Submit Blog

Home >> ADO.Net >> XmlDataSource Control in ASP.Net
XmlDataSource Control in ASP.Net
XmlDataSource Control in ASP.Net


by Pushpendra Singh on 11/4/2010 4:27:45 PM

Views: 3605       Comments: 0

XmlDataSource Control in ASP.Net

XmlDataSource is usually used to display read only XML data.

<asp:XmlDataSource ID="XmlDataSource1" runat="server">

</asp:XmlDataSource>

Important properties of XmlDataSource Control

·         DataFile: This property allows specifying the name of XML file that the XmlDataSource control binds to. You can specify either absolute file path or relative file path of XML file.

·         Data: This property gets or sets the block of XML data that the XmlDataSource control binds to. We can bind XML data inline using this property. If both DataFile and Data properties are set, the DataFile property takes precedence and the data in the XML file is used instead of XML data specified in Data property.

·         XPath: This property specifies an XPath expression which acts as filter the XML file contained by DataFile property or XML data specified by Data property.

Binding XMLDataSource to GridView

<asp:GridView ID="GridView1" runat="server" DataSourceID="XmlDataSource"

            AutoGenerateColumns="False" ShowFooter="True">

        <Columns>

        <asp:TemplateField>

        <ItemTemplate>

   

      <%#XPath("@name") %><br />

      <%#XPath("State")%><br />

      <%#XPath("city")%><br /> </ItemTemplate>

 

        </asp:TemplateField>

        </Columns>

 </asp:GridView>

 <asp:XmlDataSource ID="XmlDataSource" runat="server"DataFile="~/XMLFile.xml"

 XPath="IranHistoricalPlaces/Place">

</asp:XmlDataSource>

XmlDataSource Control in ASP.Net

XmlDataSource Control in ASP.Net

Report Abuse Form
Reason:    
 

Title :
Comment :
Text ColorBackground Color
BoldItalicUnderline
LeftCenterRightJustify
Ordered ListBulleted List
IndentOutdent
Horizontal Rule
SubscriptSuperscript
HyperlinkImage
Design ModeDesign
View HtmlHtml
     
 
Latest Article by Pushpendra SinghRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Latest BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Top Viewed ArticlesRSS Feed
    
    
    
    
    
    
    
    
    
    
Top Viewed BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
Latest Interview QuestionsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Total Online Users: 3709
Advertisement
MindStick SurveyManager
Advertise with Us
  
Copyright © 2014MindStick. All Rights Reserved.