gregburningham
Programmer
Hi
I have some code where I read a list of data items from a DataTable. Each of these rows although stored as a string is also a Control on my page. I would therefore like to convert the row.column returned from my loop into a Control that I can set properties on (such as enabled=true) etc.
Unfortunately I am getting an "Invalid Cast" error when I execute the following code ....
While vRowCount < vDataTable.Rows.Count
vDataRow = vDataTable.Rows(vRowCount)
lblMessage.Text = lblMessage.Text & vDataRow("UpdateAllowed"
If vDataRow("UpdateAllowed".ToString = "Y" Then
lblMessage.Text = lblMessage.Text & "UPD!"
vControl = CType(vDataRow("ItemName", DropDownList)
vControl.Enabled = True
End If
vRowCount = vRowCount + 1
End While
Please can someone advise me on where I am going wrong ?
Thanks in advance
Greg B
I have some code where I read a list of data items from a DataTable. Each of these rows although stored as a string is also a Control on my page. I would therefore like to convert the row.column returned from my loop into a Control that I can set properties on (such as enabled=true) etc.
Unfortunately I am getting an "Invalid Cast" error when I execute the following code ....
While vRowCount < vDataTable.Rows.Count
vDataRow = vDataTable.Rows(vRowCount)
lblMessage.Text = lblMessage.Text & vDataRow("UpdateAllowed"
If vDataRow("UpdateAllowed".ToString = "Y" Then
lblMessage.Text = lblMessage.Text & "UPD!"
vControl = CType(vDataRow("ItemName", DropDownList)
vControl.Enabled = True
End If
vRowCount = vRowCount + 1
End While
Please can someone advise me on where I am going wrong ?
Thanks in advance
Greg B