greg_quinn
Nov 11th, 2004, 03:08 AM
I am looping through all the dynamic controls in a form, if the control ID begins with an 'o', I know it is a certain type of radiobutton, and I need to see if it is checked or not. But my code below gives me the error
What is wrong with my code below?
For each pageControl in pollForm.Controls
' If the control id begins with 'o' it is an optional radiobutton
If Mid(pageControl.ID, 1, 1) = "o" Then
myControl = Page.FindControl(pageControl.ID) ' ...object reference not set to an instance of an object.
End If
If myControl.Checked Then
Response.Write("The control was checked")
End If
Next
What is wrong with my code below?
For each pageControl in pollForm.Controls
' If the control id begins with 'o' it is an optional radiobutton
If Mid(pageControl.ID, 1, 1) = "o" Then
myControl = Page.FindControl(pageControl.ID) ' ...object reference not set to an instance of an object.
End If
If myControl.Checked Then
Response.Write("The control was checked")
End If
Next