G
GG
HI
I am working with the following Microsoft sample code found at http://msdn.microsoft.com/library/d...y/en-us/dnaspp/html/creatingcustomcolumns.asp
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
Handles DataGrid1.ItemDataBoun
If e.Item.ItemType = ListItemType.EditItem The
Dim DRV As DataRowView = CType(e.Item.DataItem, DataRowView
Dim CurrentShip As String = DRV("ShipVia"
Dim DDL As DropDownList =
CType(e.Item.Cells(4).Controls(1), DropDownList
Dim SQL As String =
"SELECT ShipperID, CompanyName FROM Shippers ORDER BY ShipperID
Dim DA As SqlDataAdapter = New SqlDataAdapter(SQL, ConnStr
Dim DS As New DataSe
Dim item As ListIte
DA.Fill(DS, "Shippers"
DDL.DataSource = DS.Tables("Shippers").DefaultVie
DDL.DataTextField = "CompanyName
DDL.DataValueField = "ShipperID
DDL.DataBind(
item = DDL.Items.FindByValue(CurrentShip
If Not item Is Nothing Then item.Selected = Tru
End I
End Su
When it gets to the line "Dim DDL As DropDownList =
CType(e.Item.Cells(4).Controls(1), DropDownList)" it says the index is out of range even though I have the specified columns of data including the edit column
Any help is appreciated
Thanks
G
I am working with the following Microsoft sample code found at http://msdn.microsoft.com/library/d...y/en-us/dnaspp/html/creatingcustomcolumns.asp
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
Handles DataGrid1.ItemDataBoun
If e.Item.ItemType = ListItemType.EditItem The
Dim DRV As DataRowView = CType(e.Item.DataItem, DataRowView
Dim CurrentShip As String = DRV("ShipVia"
Dim DDL As DropDownList =
CType(e.Item.Cells(4).Controls(1), DropDownList
Dim SQL As String =
"SELECT ShipperID, CompanyName FROM Shippers ORDER BY ShipperID
Dim DA As SqlDataAdapter = New SqlDataAdapter(SQL, ConnStr
Dim DS As New DataSe
Dim item As ListIte
DA.Fill(DS, "Shippers"
DDL.DataSource = DS.Tables("Shippers").DefaultVie
DDL.DataTextField = "CompanyName
DDL.DataValueField = "ShipperID
DDL.DataBind(
item = DDL.Items.FindByValue(CurrentShip
If Not item Is Nothing Then item.Selected = Tru
End I
End Su
When it gets to the line "Dim DDL As DropDownList =
CType(e.Item.Cells(4).Controls(1), DropDownList)" it says the index is out of range even though I have the specified columns of data including the edit column
Any help is appreciated
Thanks
G