55 lines
1.2 KiB
C#
55 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Data;
|
|
using System.Text;
|
|
using System.IO;
|
|
using System.Xml;
|
|
|
|
namespace FineUI.Examples.tree.databind
|
|
{
|
|
public partial class tree_document : PageBase
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
LoadData();
|
|
}
|
|
}
|
|
|
|
|
|
private void LoadData()
|
|
{
|
|
string xmlPath = Server.MapPath("~/tree/databind/website.xml");
|
|
|
|
string xmlContent = String.Empty;
|
|
using (StreamReader sr = new StreamReader(xmlPath))
|
|
{
|
|
xmlContent = sr.ReadToEnd();
|
|
}
|
|
|
|
XmlDocument xdoc = new XmlDocument();
|
|
xdoc.LoadXml(xmlContent);
|
|
|
|
Tree1.DataSource = xdoc;
|
|
Tree1.DataBind();
|
|
|
|
}
|
|
|
|
protected void btnClear_Click(object sender, EventArgs e)
|
|
{
|
|
Tree1.DataSource = null;
|
|
Tree1.DataBind();
|
|
}
|
|
|
|
protected void btnReBind_Click(object sender, EventArgs e)
|
|
{
|
|
LoadData();
|
|
}
|
|
|
|
}
|
|
}
|