• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

Make other objects visible

I have a radiobuttonlist that has 3 values:


I also have a dropdownlist called "product", dropdownlist called "tank" and a textbox called "datetxt".

When the user selects "Product" from the radiolist I want the dropdownlist (product) to be visible and when the user selects from the radiolist "Tank", then I want the dropdownlist (tank) to be visible.  All of these controls, except for the radiolist are not visible on page_load.  The radiobuttonlist has autopostback set to True.  I thought I could write something like this, but it doesn't work.

If RadioButtonList1.SelectedItem.Text = "Product" Then
   product.Visible = True
End If
1 Solution
Have you tried this?

If RadioButton1.Checked = True
  Product.visible = true
End If
Sample for radio buttons....

  Private Sub PickRadio_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton1.Click, RadioButton2.Click, RadioButton3.Click
'Use the tag properities  in the radio button to easily find which button
        Select Case sender.tag
            Case 1
                 product.Visible = True
                tank.Visible = False
                datetxt.Visible = False            
            Case 2
                 product.Visible = False
                 tank.Visible = True
              datetxt.Visible = False            
            Case 3
                product.Visible = False
                tank.Visible = False
                datetxt.Visible = True            
        End Select
    End Sub
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now