我有兩個radio buttons
和兩個panels
在我的網頁上,我想show
面板1當單選按鈕1選中更改並隱藏面板2和類似的面板2需要顯示當單選按鈕2選中更改並隱藏PANEL1。使用單選按鈕顯示和隱藏面板
這是我怎麼沒有成功完成
這裏是我的單選按鈕:
<asp:RadioButton ID="RadioButton1" runat="server" Text="Text" ForeColor="White" GroupName="selection" OnCheckedChanged="RadioButton1_CheckedChanged"/>
<asp:RadioButton ID="RadioButton2" runat="server" Text="Image" ForeColor="White" GroupName="selection" OnCheckedChanged="RadioButton2_CheckedChanged"/>
這RadioButton1_CheckedChanged:
If RadioButton1.Checked = True Then
RadioButton2.Checked = False
Panel1.Visible = True
Panel2.Visible = False
End If
這RadioButton2_CheckedChanged:
If RadioButton2.Checked = True Then
RadioButton1.Checked = False
Panel1.Visible = False
Panel2.Visible = True
End If
需要將Autopostback設置爲true纔能有效工作。 – JonH 2012-02-07 16:36:32