Exemple #1
0
    /// <summary>
    /// 建立樹狀結構
    /// </summary>
    private void BindTree(DataSet dsTemp)
    {
        dsMenu = dsTemp;

        //根目錄層
        DataTable dt2 = dsMenu.Tables[0].Clone();

        foreach (DataRow dr in dsMenu.Tables[0].Select("OrderBy='00' "))
        {
            dt2.ImportRow(dr);
        }

        Tree1.DataSource = dt2;
        Tree1.DataBind();
    }
        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();
        }
Exemple #3
0
 private void LoadData()
 {
     Tree1.DataSource = XmlDataSource1;
     Tree1.DataBind();
 }
 protected void btnClear_Click(object sender, EventArgs e)
 {
     Tree1.DataSource = null;
     Tree1.DataBind();
 }