I new to ASP.NET and got slightly confused on a probably simple little
issue.
I am try to iterate through some ASP radio buttons to see which of them is
checked.
But I get the error :
Unable to cast object of type 'System.Web.UI. LiteralControl' to type
'System.Web.UI. WebControls.Rad ioButton'.
The error occurs in the line : For Each rdbChecked In Me.Controls
Any help would be much appreciated. TIA
Protected Sub cmdSearch_Click (ByVal sender As Object, ByVal e As
System.EventArg s)
Dim rdbChecked As RadioButton
Dim sURL As String = ""
For Each rdbChecked In Me.Controls
If rdbChecked.Chec ked Then
sURL = GetSearchString (rdbChecked.ID) & txtSearch.Text
End If
Next
Response.Redire ct(sURL)
End Sub
issue.
I am try to iterate through some ASP radio buttons to see which of them is
checked.
But I get the error :
Unable to cast object of type 'System.Web.UI. LiteralControl' to type
'System.Web.UI. WebControls.Rad ioButton'.
The error occurs in the line : For Each rdbChecked In Me.Controls
Any help would be much appreciated. TIA
Protected Sub cmdSearch_Click (ByVal sender As Object, ByVal e As
System.EventArg s)
Dim rdbChecked As RadioButton
Dim sURL As String = ""
For Each rdbChecked In Me.Controls
If rdbChecked.Chec ked Then
sURL = GetSearchString (rdbChecked.ID) & txtSearch.Text
End If
Next
Response.Redire ct(sURL)
End Sub
Comment