Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I can't believe I'm having this much trouble moving into .NET. Anyway, I'm 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

 

That's the most recent look of what I've tried to do. I think I've 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 it's not hard and I'm just having the "newbie blues" with .NET right now.

 

Regards.

Posted

Even this won't 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!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...