<SCRIPT language="vb" runat="server">
Public class maclasse
Public Sub Initialiser_Regions(ByVal DropDown as System.Web.UI.WebControls.DropDownList,DS as System.Data.DataSet,ByVal Id_Region as integer)
Dim drRegion as System.Data.Datarow() = oDataSet.Tables("Region" ).Select("","Position" )
Dim i as integer
For i = 0 To drRegion.Length - 1 DropDown.Items.Add(New ListItem(drRegion(i)("Nom_Fr" ),drRegion(i)("Id" )))
Next
DropDown.SelectedIndex = DropDown.Items.IndexOf(DropDown.Items.FindByValue(Id_Region))
End Sub
end class
Private obj as New maClasse()
Sub Page_OnLoad()
obj.Initialiser_Regions(ddl,LeDataSet,4)
End Sub
</SCRIPT>
<body>
<form runat="server">
<asp:dropdownlist id="ddl" runat="server"></asp:dropdownlist>
</form>
</body>
|