web 2.0

ASP.NET(vb.net) & XmlDataSource - asp:XmlDataSource

ASP.NET(vb.net) & XmlDataSource - asp:XmlDataSource - The XmlDataSource represents an XML data source to data-bound controls.

ShotDev Focus:
- ASP.NET(vb.net) & XmlDataSource - asp:XmlDataSource

ASP.NET(vb.net) & XmlDataSource - asp:XmlDataSource

Tag Control :


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

ASP.NET(vb.net) & XmlDataSource - asp:XmlDataSource

Drag XmlDataSource Control to ASP.NET Web Form. on XmlDataSource Tasks -> Configure Data Source.

ASP.NET(vb.net) & XmlDataSource - asp:XmlDataSource

Browse a XML File

ASP.NET(vb.net) & XmlDataSource - asp:XmlDataSource

Select XML File.

customer.xml

<?xml version="1.0" encoding="UTF-8"?>
<mydatabase>
<customer Name="Win Weerachai">
</customer>
<customer Name="Jake Sully">
</customer>
<customer Name="Tony Stark">
</customer>
<customer Name="Peter Parker">
</customer>
</mydatabase>

ASP.NET(vb.net) & XmlDataSource - asp:XmlDataSource

Data file and XPath expression

ASP.NET(vb.net) & XmlDataSource - asp:XmlDataSource

Drag DropDownList Control to ASP.NET Web Form . On DropDownList Tasks -> Choose Data Source...

ASP.NET(vb.net) & XmlDataSource - asp:XmlDataSource

Select a data source XmlDataSource, Select a data field to display in the DropDownList , Select a data field for the value of the DropDownList.

Example Code

Default.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/App_Data/customer.xml" XPath="mydatabase/customer"></asp:XmlDataSource>
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="XmlDataSource1" DataTextField="Name" DataValueField="Name">
</asp:DropDownList>

</div>
</form>
</body>
</html>

Default.aspx.vb

Partial Class _Default
Inherits System.Web.UI.Page

End Class

Screenshot

ASP.NET(vb.net) & XmlDataSource - asp:XmlDataSource

.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.