[VB.net 1.1] dropdownlist dans repeater
Bonjour,
Je voudrais qu'à la selection d'un nom de produit dans mon dropdownlist, le client consult la page de ce produit.
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| <ul>
<asp:Repeater id="CatList" runat="server" OnItemDataBound="R1_ItemDataBound">
<ItemTemplate>
<li>
<asp:Label ID="CatId" text='<%# DataBinder.Eval(Container.DataItem, "CatId") %>' Visible=False Runat=server>
</asp:Label>
<asp:Label ID="NomProd" Visible=False Runat=server>
</asp:Label>
<asp:HyperLink id="HyperLink1" Text='<%# DataBinder.Eval(Container.DataItem, "NomCat") %>' NavigateUrl='<%# "Categories.aspx?CatID=" & DataBinder.Eval(Container.DataItem, "CatID") & "&selectmenu=" & Container.ItemIndex %>' runat="server" />
<aspropDownList ID="ProdList" OnSelectedIndexChanged="Selection_Change" Runat="server" AutoPostBack="true"></aspropDownList>
</li>
</ItemTemplate>
</asp:Repeater></ul> |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Public Sub R1_ItemDataBound(ByVal Sender As Object, ByVal e As RepeaterItemEventArgs) Handles CatList.ItemDataBound
If (e.Item.ItemType = ListItemType.Item) Or _
(e.Item.ItemType = ListItemType.AlternatingItem) Then
'Liste des produits
Dim Cat As Integer
Cat = CInt(CType(e.Item.FindControl("CatId"), Label).Text)
Dim Produits As Altearah.HuilesRares.ProduitDB = New Altearah.HuilesRares.ProduitDB
CType(e.Item.FindControl("ProdList"), DropDownList).DataSource = Produits.ListDistProdByCat(Cat, "NomProd")
CType(e.Item.FindControl("ProdList"), DropDownList).DataTextField = "NomProd"
CType(e.Item.FindControl("ProdList"), DropDownList).DataValueField = "NomProd"
CType(e.Item.FindControl("ProdList"), DropDownList).DataBind()
End If
End Sub |
Comment récupérer le nomProd dans l'opération
Code:
1 2 3
| Public Sub Selection_Change(ByVal sender As Object, ByVal e As EventArgs)
End Sub |