I'm trying to show/hide a Div tag (which contains other asp.net controls) on a RadioButtonList OnSelectedIndexChanged event.
Issue: When i show Div tag, the controls in the Div tag are not visible. See my code below
.aspx page
<asp:RadioButtonList ID="rblTesting" runat="server" AutoPostBack="true" OnSelectedIndexChanged="rblTesting_SelectedIndexChanged">
<asp:ListItem Text="Show" Selected="True" Value="0"></asp:ListItem>
<asp:ListItem Text="Hide" Value="1"></asp:ListItem>
</asp:RadioButtonList>
<div id="divName" runat="server">
<asp:Label ID="lblFirstName" runat="server" Text="James"></asp:Label>
<asp:Label ID="lblLastName" runat="server" Text="Anderson"></asp:Label>
</div>
.aspx.cs
Protected Sub rblTesting_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
If rblTesting.SelectedIndex = 0 Then
divName.Visible = True
'lblFirstName and lblLastName labels are not visible?
Else
divName.Visible = False
End If
End Sub
I can show/hide individual controls in the Div on selected index changed event. But, my question is why does my controls are not visible when the Div is visible.