Default2.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default2.aspx.cs"
Inherits="CalenderControl.Default2" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
TreeView Control navigation <asp:TreeView ID="TreeView1" runat="server"
Width="150px" ImageSet="Arrows">
<Nodes>
<asp:TreeNode Text="ASP.net Practical" Value="New Node"></asp:TreeNode>
<asp:TreeNode Text="Calender Control" Value="New Node"
NavigateUrl="~/Default.aspx"></asp:TreeNode>
</Nodes>
<NodeStyle Font-Names="Rupam" Font-Size="10pt" ForeColor="Black"
HorizontalPadding="5px" NodeSpacing="0px" VerticalPadding="0px" />
<ParentNodeStyle Font-Bold="false" />
<SelectedNodeStyle Font-Underline="true" ForeColor="#9966FF"
VerticalPadding="0px" HorizontalPadding="0px" />
</asp:TreeView> <br />
Fetch Dataliat Using XML data:
</div>
<asp:DataList ID="DataList1" runat="server">
<ItemTemplate>
<table class="table" border="1">
<tr>
<td>
Roll Num:<%# Eval("sid") %><br />
Name:<%# Eval("sname") %><br />
Class:<%# Eval("sclass") %><br />
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</form>
</body>
</html>
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
namespace CalenderControl
{
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
}
protected void BindData()
{
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("stdetail.xml"));
if (ds != null && ds.HasChanges())
{
DataList1.DataSource = ds;
DataList1.DataBind();
}
else
{
DataList1.DataBind();
}
}
}
}
Stdetail.xml
<?xml version="1.0" encoding="utf-8" ?>
<studentdetail>
<student>
<sid>1</sid>
<sname>Rupam</sname>
<sclass>TYIT</sclass>
</student>
<student>
<sid>2</sid>
<sname>Uttam</sname>
<sclass>TYCS</sclass>
</student>
<student>
<sid>3</sid>
<sname>Yashashree</sname>
<sclass>TYIT</sclass>
</student>
<student>
<sid>4</sid>
<sname>Priyanka</sname>
<sclass>TYCS</sclass>
</student>
</studentdetail>
0 Comments