Comment accéder à un item d'une DataList ?
Bonjour, ca fait un moment que j'essaie differentes choses mais pas moyen de trouver de solution...
Voila mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSourceResultat">
<ItemTemplate>
<table class = "tableFormu"> <tr><td>
<asp:Label ID="nomLabel" runat="server" Text='<%# Eval("nom") %>'></asp:Label>
</td><td >
<asp:Label ID="prenomLabel" runat="server" Text='<%# Eval("prenom") %>'></asp:Label>
</td> <td>
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" OnCheckedChanged="Check_Clicked"/></td></tr></table>
</ItemTemplate>
<AlternatingItemStyle BackColor="LightGray" Font-Bold="False" Font-Italic="False"
Font-Overline="False" Font-Strikeout="False" Font-Underline="False" />
</asp:DataList> |
Donc j'ai mon datalist avec ses differents élément dont un checkbox en autopostback. Ce que j'aimerais c'est que quand je click sur le checkbox, il m'ouvre un msgbox contenant nom et prenom. Le prob c'est que je sais vraiment pas comment faire :s
J'avais pensé a ça en code behind
Code:
1 2 3 4 5 6 7
| Sub Check_Clicked(ByVal sender As Object, ByVal e As EventArgs)
MsgBox(Eval("nom") & " " & Eval("prenom"))
End Sub |
Mais ca ne donne rien. De plus nomLabel.text n'est pas reconnu...
Savez-vous comment je pourrais faire???