Gracias Rootk por la respuesta
He probado el código que me has enviado (he sustiutido Handles DataGrid1.ItemDataBound por dgProducts.ItemDataBound) pero no me funciona me da el siguietne error:
BC30506: La cláusula Handles requiere una variable WithEvents
He quitado el "Handles dgProducts.ItemDataBound"
Código:
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
dim i as integer
Dim ddl As DropDownList = CType(e.Item.FindControl("cboOrden"), DropDownList)
For i = 0 To 10
ddl.Items.Add(New ListItem(i, i))
Next
End If
End Sub
y en el datagrid he declarado lo siguiente :
Código:
<asp:DataGrid id="dgProducts" runat="server" Width="500px"
AutoGenerateColumns="False" CellPadding="4" OnEditCommand="dgProducts_Edit"
OnUpdateCommand="dgProducts_Update" OnCancelCommand="dgProducts_Cancel"
OnDeleteCommand="dgProducts_Delete" showFooter="True" PageSize="5"
DataKeyField="idSubmenu" ItemDataBound="DataGrid1_ItemDataBound">
Ahora no me dá error pero tampoco me rellena el dropdown....
Que estoy haciendo mal?
Aparte de esto la linea:
Código:
If e.Item.ItemType = ListItemType.Item
Or e.Item.ItemType = ListItemType.AlternatingItem Then
no sé su significado ......