G
Guest
Hi,
I have a datagrid with 3 columns. One of the columns (quantity) is a
template column with dopdownlist. I want to be able to populate the
dropdownlist for each row with different data (based on the data in the first
column. I am trying this but doesn't work
Private Sub grdTranx_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
grdTranx.ItemDataBound
If e.Item.ItemType = ListItemType.EditItem And e.Item.ItemType <>
ListItemType.Header And e.Item.ItemType <> ListItemType.Footer Then
Dim dList As DropDownList = CType(e.Item.FindControl("DropDownList2"),
DropDownList)
Dim aList = New ArrayList
aList.Add(e.Item.Cells(0).Text.ToString) 'This is just a test. I will
actually be doing some checking in a database here and then returning a value
that will than be passed to the dropdownlist
dList.DataSource = aList
End If
End Sub
The gris is being bound at formload with
DataGrid1.DataSource = GetTrax(535) 'sqldatareader is returned here
DataGrid1.DataBind()
The columns are
name,type,quantity
Any ideas?
I have a datagrid with 3 columns. One of the columns (quantity) is a
template column with dopdownlist. I want to be able to populate the
dropdownlist for each row with different data (based on the data in the first
column. I am trying this but doesn't work
Private Sub grdTranx_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
grdTranx.ItemDataBound
If e.Item.ItemType = ListItemType.EditItem And e.Item.ItemType <>
ListItemType.Header And e.Item.ItemType <> ListItemType.Footer Then
Dim dList As DropDownList = CType(e.Item.FindControl("DropDownList2"),
DropDownList)
Dim aList = New ArrayList
aList.Add(e.Item.Cells(0).Text.ToString) 'This is just a test. I will
actually be doing some checking in a database here and then returning a value
that will than be passed to the dropdownlist
dList.DataSource = aList
End If
End Sub
The gris is being bound at formload with
DataGrid1.DataSource = GetTrax(535) 'sqldatareader is returned here
DataGrid1.DataBind()
The columns are
name,type,quantity
Any ideas?