Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8239841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:17:00+00:00 2026-06-07T20:17:00+00:00

I need to go through a loop and check the proper radiobutton. I have

  • 0

I need to go through a loop and check the proper radiobutton. I have multiple radio button named rb with a color such as “rbGreen, rbRed, rbYellow…”

Here is my code behind: (listColors is a list of strings)

 Private Sub selectColor(color As String)
    Dim i As Integer
    For i = 0 To listColors.Count - 1 
        If listColors(i) = color Then
            Dim rb As RadioButton = TryCast(Page.FindControl("rb" & color), RadioButton)
            rb.Checked = True
        End If
    Next i
End Sub

While debugging, I got an error because rb is nothing…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T20:17:02+00:00Added an answer on June 7, 2026 at 8:17 pm

    My guess is that the RadioButtons in question are not actually part of the Page, and are instead part of a UserControl or template based control (such as a Repeater).

    If so, then you need to modify your code to use the FindControl of the control that holds the RadioButtons in question.

    If this is within a UserControl the easiest thing to do is something like…

    Me.FindControl("rb" & color)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to periodically loop through links in my PHP database to check whether
i have the following code ..i need to loop through end of the file
my heading kinda explains the problem. I need to loop through multiple ul tags
I have a foreach loop in jQuery going through each 'div.panel', I need to
I need to loop through my django list that I have passed to the
Can anyone please help. I have a problem where I need to loop through
I have a large NSDictionary that I need to loop through and create separate
I need to check a form before submitting but need to loop through some
I have a nested JSON object that I need to loop through, and the
I have a list of words, in Python I need to loop through each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.