Cast Error from control in DataGrid cell

G

Guest

Hi,

I am having a problem with the following line of code:

oDR("UIGroupTypeID") = CType(e.Item.Cells(3).Controls(0),
DropDownList).SelectedValue

The error I get is the Cast is not valid.

Any ideas?

I have tried to get the actual type at runtime just before the error occurs
with this line of code:
Dim s As String =
e.Item.Cells(3).Controls(0).GetType.UnderlyingSystemType.ToString

The value of s is System.Web.UI.LiteralControl

Thanks,

Chris Lane
 
G

Guest

Is there a way I can get the index or column that the control is in by it's
name?
 
G

Guest

Looks like this code that is based off of a codesmith template that someone
shared is wrong when it references the controls index within the datagrid
column.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top