Hi there,
What you need to do is handle the datagrid's ItemDataBound event. The event
argument will contain the datagrid Item. Check the type of the item so you
can populate it only when you need to, and databind the combo box
programmatically. E.g:
Private Sub sample_ItemDataBound(ByVal sender As System.Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles sample.ItemDataBound
Select Case e.Item.ItemType
Case ListItemType.Item, ListItemType.AlternatingItem
Dim ddList As DropDownList
ddList = CType(e.Item.Cells(3).Controls(1), DropDownList)
ddList.DataSource = MyDataSource
ddList.DataBind()
End Select
End Function
Good luck!
--
Juan Romero
-----------------------------------------
The successful person has the habit of doing the things failures don't like
to do.
E.M. Gray
"Oldhandandy" wrote:
I've created a combobox in a datagrid, it works OK using the code where
"supplier1" and "supplier2" are the items. However, instead of using hard
coded items, I want to use data obtained from the dataset DsSupplier1. Any
help would be most appreciated.
SqlDataSupplier.Fill(DsSupplier1)
suppcombo.Name = "Suppcombo"
suppcombo.Visible = False
suppcombo.Items.Clear()
suppcombo.Items.Add("supplier1")
suppcombo.Items.Add("Supplier2")
DataGrid1.Controls.Add(suppcombo)