|
-
Nov 11th, 2004, 04:08 AM
#1
Thread Starter
Hyperactive Member
Control not being found when looping through controls
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
-
Nov 11th, 2004, 07:49 AM
#2
I wonder how many charact
A simpler way may be to just add an Attribute to the control after you create it, and search for the existence of that attribute.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|