getting the value of a DropDownList item for updating?

Joined
Jan 22, 2003
Messages
22
Location
Indiana, USA
I cant believe Im having this much trouble moving into .NET. Anyway, Im getting a Cast error when reading in the text of a selected item when updating a record in a DataGrid.

Dim ContainerName As String = e.Item.Cells(2).Controls(0).DropDrownList.SelectedItem.Text

Thats the most recent look of what Ive tried to do. I think Ive tried about every combination to get the value into a variable with no luck at all. There is a value for this item, so I just need to dump it into a string. I know its not hard and Im just having the "newbie blues" with .NET right now.

Regards.
 
Even this wont work:

Dim TempList As DropDownList
Dim TempValue As String

TempList = E.Item.FindControl("selContainerName")
TempValue = TempList.SelectedItem.Value

The selContainer name is being created when editing the grid, but I get an "Object reference not set to an instance of an object" error when I try to pull the value.

Any thoughts? Thanks!
 
Back
Top