By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,122 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

A reloaded page don't reflect change on his treeview...

P: n/a
Ryo
Hello !

I have this simple aspx page:
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="test_treeview.aspx.cs" Inherits="test_treeview" Title="Treeview" %>

<asp:Content ID="cntCorpCentre" ContentPlaceHolderID="cphCorpCentre"
EnableViewState="false" RunAt="Server">
<asp:TreeView ID="Organigramme" SkinID="Organigramme"
EnableViewState="false" RunAt="server" />
</asp:Content>

And the associated code:
using System;
using System.Web.UI.WebControls;
using System.Xml;

public partial class test_treeview : System.Web.UI.Page{
protected void Page_Load(object sender, EventArgs e){
XmlDataSource xdsOrganigramme = new XmlDataSource();

System.Windows.Forms.MessageBox.Show(new Organigramme().xml.InnerXml);

xdsOrganigramme.Data = new Organigramme().xml.InnerXml;
xdsOrganigramme.DataBind();
System.Windows.Forms.MessageBox.Show(xdsOrganigram me.Data);

Organigramme.DataSource = xdsOrganigramme;
Organigramme.DataBind();
System.Windows.Forms.MessageBox.Show((Organigramme .DataSource as
XmlDataSource).Data);

xdsOrganigramme.Dispose();
}
}

new Organigramme().xml.InnerXml return the content of a generated XML file
like this:
<?xml version="1.0" encoding="utf-8">
<Society>
<Computing>
<User Name="Ryo"/>
</Computing>
<Finance>
<User Name="Bill"/>
</Finance>
</Society>

For this the treeview seem like that:
Society
|-Computing
| |-Ryo
|
|-Finance
| |-Bill

Now, I put Bill in computing and I reload the page.
The XML of the DataSource of the Treeview is like that:
<?xml version="1.0" encoding="utf-8">
<Society>
<Computing>
<User Name="Ryo"/>
<User Name="Bill"/>
</Computing>
</Society>

But the displayed treeview is always:
Society
|-Computing
| |-Ryo
|
|-Finance
| |-Bill

Why changes are not reflected on my treeview ? How to change this ?
Thanks in advance.
Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.