J
Jason Callas
The first column on my grid is a ButtonColumn type. I want to be able to get
the Text value from withing the ItemCommand event.
I know that e.Item.Cells(0).Text returns an empty string because the cell
has a button control on it. So I thought I would use the control collection
of the cell instead. Because it is a control I should be casting it as a
specific type. Unfortunely this is returning a casting error.
The following code returns and error:
Dim symbol As String
symbol = CType(e.Item.Cells(0).Controls(0),
Web.UI.WebControls.Button).Text
Error = System.InvalidCastException: Specified cast is not valid.
Any thoughts would be appreciated.
- Jason
the Text value from withing the ItemCommand event.
I know that e.Item.Cells(0).Text returns an empty string because the cell
has a button control on it. So I thought I would use the control collection
of the cell instead. Because it is a control I should be casting it as a
specific type. Unfortunely this is returning a casting error.
The following code returns and error:
Dim symbol As String
symbol = CType(e.Item.Cells(0).Controls(0),
Web.UI.WebControls.Button).Text
Error = System.InvalidCastException: Specified cast is not valid.
Any thoughts would be appreciated.
- Jason