In this article we will discuss how to bind XML data to a Web Form control in ASP.Net.
Suppose we have the requirement that a web site needs to create a Web Application to store the details in XML data format of the products available for sale. The details of the products should be displayed in a data grid. The details include product id, product name, description, price, quantity available and category. The form should have an advertisement banner. When the user clicks the banner, the order form of the WebShoppe Website should be displayed.
Let's have a look at the following steps:
<?xml version="1.0" encoding="utf-8" ?><productdata> <product category="toy"> <prodid> P001 </prodid> <productname>Mini Bus</productname> <description>This is a toy for children aged 4 and above</description> <price>75</price> <qtyavilable>54</qtyavilable> </product> <product category="toy"> <prodid> P002 </prodid> <productname>Barbie Doll</productname> <description>This is a toy for children in the age group of 5-10</description> <price>100</price> <qtyavilable>200</qtyavilable> </product></productdata>
<?xml version="1.0" encoding="utf-8" ?><Advertisements> <Ad> <ImageUrl>http://localhost:1330/productdetails/Images/myshopping.jpg</ImageUrl> <NavigateUrl>http://localhost:1330/productdetails/Onlineshopping.aspx</NavigateUrl> <AlternateText>The Order Online Form for WebShoppe</AlternateText> <Impressions>1</Impressions> </Ad> <Ad> <ImageUrl>http://localhost:1330/productdetails/Images/barbiel2.jpg</ImageUrl> <NavigateUrl>http://localhost:1330/productdetails/Onlineshopping.aspx</NavigateUrl> <AlternateText>The Order Online Form for WebShoppe</AlternateText> <Impressions>2</Impressions> </Ad></Advertisements>
Active Directory-222