A
Adam Knight
Hi all,
I am trying to preselect a value in a dropdown list contained in a DataGrid
via the 'SelectedValue' method.
I tried using Container.DataItem in the DataGrid onItemDataBound method and
an error was issued.
'Container not declared'.
Can anyone suggest how i am supposed to retrieve the require db value.
'ensure current data grid row is not a header or footer, not a category and
is being edited
If(e.Item.ItemType <> ListItemType.Header And e.Item.ItemType <>
ListItemType.Footer And e.Item.ItemIndex = dgMyGrid.EditItemIndex)
'preselect db value in drop down list
CType(e.Item.Cells(1).Controls(1),DropDownList).SelectedValue =
Container.DataItem("optional_questions")
End If
Cheers,
Adam
I am trying to preselect a value in a dropdown list contained in a DataGrid
via the 'SelectedValue' method.
I tried using Container.DataItem in the DataGrid onItemDataBound method and
an error was issued.
'Container not declared'.
Can anyone suggest how i am supposed to retrieve the require db value.
'ensure current data grid row is not a header or footer, not a category and
is being edited
If(e.Item.ItemType <> ListItemType.Header And e.Item.ItemType <>
ListItemType.Footer And e.Item.ItemIndex = dgMyGrid.EditItemIndex)
'preselect db value in drop down list
CType(e.Item.Cells(1).Controls(1),DropDownList).SelectedValue =
Container.DataItem("optional_questions")
End If
Cheers,
Adam