<%@ Page Language="vb" %> <script language="vb" runat="server"> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DropDownList1.Datasource = Split("1,2,3,4",",") DropDownList1.databind DropDownList2.Datasource = Split("a,b,c,d",",") DropDownList2.databind end sub public sub DropChanged(sender As Object, e As System.EventArgs) DropDownList2.visible = true end sub </script> <html> <form id="Form1" method="post" runat="server"> </form> </html>
<%@ Page Language="vb" %> <script language="vb" runat="server"> 'Point d'entrée de l'application avec des parametres qui peuvent etre utiles dans certains cas Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) 'Je lie des données à mon dropdownlist ca peut se faire autrement 'mais c'est ce qu'il y a de plus simple il suffit juste de mettre un tableau 'en source de donnée et de databinder ces données a ton controle DropDownList1.Datasource = Split("1,2,3,4",",") DropDownList1.databind 'idem DropDownList2.Datasource = Split("a,b,c,d",",") DropDownList2.databind end sub 'LA methode appellé qd on change d'index pour le dropdownlist1 public sub DropChanged(sender As Object, e As System.EventArgs) 'Si il change on le met le 2 à visible DropDownList2.visible = true end sub </script> <html> <form id="Form1" method="post" runat="server"> <!-- ton premier dropdownlist avec la valeur autopostback pour que si on change le 2 devient visible ca se fait via la propriété onselectedindexchanged---> <!---Le N°2----> </form> </html>