DataList ne s'affiche pas [Résolu]
IslandMan974
- Messages postés
-
104
- Date d'inscription
- mercredi 4 mai 2005
- Statut
- Membre
- Dernière intervention
- 27 juin 2007
-
IslandMan974
- Messages postés
-
104
- Date d'inscription
- mercredi 4 mai 2005
- Statut
- Membre
- Dernière intervention
- 27 juin 2007
-
Bonjour,
J'essaye recuperer et d'afficher le contenu de mon XML dans une datalist.
Pour ce qui est de la recuperation tout marche bien.
Je reussi a creer mes colonnes et a y inserer mes donnees contenues dans le XML.
Mais l'affichage ne fonctionne pas
Avez vous une idee?
Merci
public
void DispayXmlFile() {
DataList DataList1 =
new
DataList();
DataList1.DataSource = GetDataSource();
DataList1.DataBind(); pas d'affichage sur ma page
}
ICollection GetDataSource()
{
XmlPortfolioUpdate.Load(PathXML);
DataTable dtInstrument =
new
DataTable();
DataRow drInstrument;
for (
int i = 0; i < NodeName.Length; i++)
{
dtInstrument.Columns.Add(
new
DataColumn(NodeName[i].ToString(),
typeof(
string)));
}
XmlNodeList objChildNode = XmlPortfolioUpdate.GetElementsByTagName(
"Position");
foreach (
XmlNode objNode
in objChildNode)
{
drInstrument = dtInstrument.NewRow();
for (
int i = 0; i < NodeName.Length; i++)
{
drInstrument[i] = objNode.ChildNodes[i].InnerText;
}
dtInstrument.Rows.Add(drInstrument);
}
DataView dvInstrument =
new
DataView(dtInstrument);
return dvInstrument;// ici j'ai bien ma mes donnees dans ma Table
}