Bonjour,
Je récupère les informations sous le format XML d'un service Web...
Je mets les informations dans un " Generic List<type>" et les affiche par la "classe PlaceHolder".
Affichage c'est en ordre de l'information venue par le service WEB donc par "Id".
Comment peux-je changer l'affichage de cet ordre : par exemple selon "BwEtatId"
---Pour clarifier la situation : -----
Voici mon code :
---Pour clarifier la situation : -----
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116 List<ConstructIdent> monListSansAnnulation = new List<ConstructIdent>(); int etatId; foreach (ConstructIdent inscription in monInscription) { etatId = inscription.BwEtatId; if (!etatId.Equals(3)) { monListSansAnnulation.Add(inscription); } } int i = 1; PlaceHolder1.Controls.Add(new LiteralControl("<table id = resultat>")); PlaceHolder1.Controls.Add(new LiteralControl("<tr><td><b>Inscription No.</b></td><td class= paire><b>Description</b></td><td><b>Etat</b></td><td class= paire><b>Debut</b></td><td><b>Fin</b></td><td class= paire><b>changement</b></td></tr>")); tVisualiserPageState.Inscriptions = new ConstructIdent[monListSansAnnulation.Count]; foreach (ConstructIdent inscription in monListSansAnnulation) { etatId = inscription.BwEtatId; string etats; switch (etatId) { case 0: etats = "Pas encore"; break; case 1: etats = "Actif"; break; case 2: etats = "Suspendu"; break; case 3: etats = "Annulé"; break; case 4: etats = "Expiré"; break; default: etats = "non identifié"; break; } PlaceHolder1.Controls.Add(new LiteralControl("<tr>")); // inscription id PlaceHolder1.Controls.Add(new LiteralControl("<td>")); Label inscriptionIdLabel = new Label(); inscriptionIdLabel.ID = "inscriptionIdLabel" + i.ToString(); inscriptionIdLabel.Text = inscription.Id.ToString(); PlaceHolder1.Controls.Add(inscriptionIdLabel); PlaceHolder1.Controls.Add(new LiteralControl("</td>")); // descriptionData PlaceHolder1.Controls.Add(new LiteralControl("<td class= paire>")); Label descriptionDataLabel = new Label(); descriptionDataLabel.ID = "descriptionDataLabel" + i.ToString(); descriptionDataLabel.Text = GetDescriptionData(inscription.BaseId); PlaceHolder1.Controls.Add(descriptionDataLabel); PlaceHolder1.Controls.Add(new LiteralControl("</td>")); PlaceHolder1.Controls.Add(new LiteralControl("<td>")); // etats Label etatsLabel = new Label(); etatsLabel.ID = "etatsLabel" + i.ToString(); etatsLabel.Text = etats; PlaceHolder1.Controls.Add(etatsLabel); PlaceHolder1.Controls.Add(new LiteralControl("</td>")); PlaceHolder1.Controls.Add(new LiteralControl("<td class= paire>")); // Debut etat Label DepartDebutLabel = new Label(); DepartDebutLabel.ID = "DepartDebutLabel" + i.ToString(); DepartDebutLabel.Text = GetDepartDescription(inscription.BaseId, inscription.IdDepart); PlaceHolder1.Controls.Add(DepartDebutLabel); PlaceHolder1.Controls.Add(new LiteralControl("</td>")); PlaceHolder1.Controls.Add(new LiteralControl("<td>")); // Fin etat Label FinDebutLabel = new Label(); FinDebutLabel.ID = "FinDebutLabel" + i.ToString(); FinDebutLabel.Text = GetDepartDescription(inscription.BaseId, inscription.IdFin); PlaceHolder1.Controls.Add(FinDebutLabel); PlaceHolder1.Controls.Add(new LiteralControl("</td>")); // bouton changement PlaceHolder1.Controls.Add(new LiteralControl("<td class= paire>")); Button changementBouton = new Button(); changementBouton.ID = "changementBouton_" + i.ToString(); changementBouton.Text = "Rectifier"; if ((inscription.BwEtatId == 3)) changementBouton.Enabled = false; changementBouton.Click += new System.EventHandler(this.changementBouton_Click); PlaceHolder1.Controls.Add(changementBouton); PlaceHolder1.Controls.Add(new LiteralControl("</td>")); PlaceHolder1.Controls.Add(new LiteralControl("</tr>")); tVisualiserPageState.Inscriptions[i - 1] = inscription; i++; } PlaceHolder1.Controls.Add(new LiteralControl("</table>")); SavePageState();
voici exemple des informatiosn venu par Web service :
Merci....<?xml version="1.0" encoding="utf-8" ?>
<ArrayConstructIdent xmlnssi="http://www.w3.org/2001/XMLSchema-instance" xmlns
sd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.toto.com/DataBase/BW">
<ConstructIdent>
<Id>5</Id>
<BaseId>1a1</BaseId>
<BwEtatId>4</BwEtatId>
<IdDepart>4408R</IdDepart>
<IdFin>4410R</IdFin>
</ConstructIdent>
<ConstructIdent>
<Id>9</Id>
<BaseId>1a1</BaseId>
<BwEtatId>0</BwEtatId>
<IdDepart>4408R</IdDepart>
<IdFin>4410R</IdFin>
</ConstructIdent>
<ConstructIdent>
<Id>18</Id>
<BaseId>1a1</BaseId>
<BwEtatId>1</BwEtatId>
<IdDepart>4408R</IdDepart>
<IdFin>4410R</IdFin>
</ConstructIdent>
</ArrayConstructIdent>![]()
Partager