0
我想在RadioButtonList的OnSelectedIndexChanged事件上顯示/隱藏Div標籤(其中包含其他asp.net控件)。當Div標籤可見時,Div標籤中的Asp.net控件不可見?
問題:當我顯示Div標籤時,Div標籤中的控件不可見。見下面
.aspx頁面中我的代碼
<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
我可以顯示/隱藏選定的指數變化事件在div個人控制。但是,我的問題是爲什麼我的控件在Div可見時不可見。