Bonjour,

je faisais un test tout bête :
Coté aspx :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
<div runat="server" id="divTest">
            <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
            <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
        </div>
Coté code beside :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
protected void Page_Load(object sender, EventArgs e)
    {
        foreach (var control in this.divTest.Controls)
        {
            Label lbControl = control as Label; //initialement, j'avais testé le cast explicite qui a pété... (Label)control
            if (lbControl != null)
            lbControl.Text = "toto";
        }
    }
avec un point d'arrêt sur la boucle, je retrouve un count de Controls à 5.
Avez-vous une explication ?
Merci,
A+