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

G

Guest

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(xdsOrganigramme.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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top