Torna al Thread
Protected Sub popolaDdl(ByVal sender As Object, ByVal e As EventArgs)
Dim ddl As DropDownList = DirectCast(sender, DropDownList)
'add an empty item on top of the list
Dim fundb As New DataUtility.GenericDatabaseFunction
Dim dt As New Data.DataTable
dt = 'popolo dataTable
For Each dtr As Data.DataRow In dt.Rows
ddl.Items.Add(dtr("campoDb"))
Next
End Sub
<asp:TemplateField HeaderText="Tipo Attrezzatura">
<EditItemTemplate>
<asp:DropDownList ID="ddl1" AppendDataBoundItems="true"
runat="server" AutoPostBack="True" OnDataBound=popolaDdl>
<asp:ListItem Value="">Select an Item</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Tipo_Attrezzatura") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>