?? ex20vb.aspx
字號:
<html>
<title>第二十例 Panel、RadioButton和 RadioButtonList控件使用</title>
<head>
<script language="VB" runat="server">
Sub Page_Load(Sender As Object, e As EventArgs)
' 判斷那個按鈕被選擇,然后設定Panel的背景圖片屬性
if Radio1.Checked
Panel1.BackImageUrl = "bg1.jpg"
else if Radio2.Checked
Panel1.BackImageUrl = "bg2.jpg"
End If
'判斷哪一個被選擇,然后在Label1上給出提示信息
If RadioButtonList1.SelectedIndex > -1 Then
Label1.Text="您選擇的是: " & RadioButtonList1.SelectedItem.Text
End If
End Sub
Sub SubmitBtn_Click(Sender As Object, e As EventArgs)
'把RadioButtonList1移入Panel中
Panel1.Controls.add(RadioButtonList1)
End Sub
</script>
</head>
<body>
<h3><font face="Verdana">第二十例 Panel、RadioButton和 RadioButtonList控件使用</font></h3>
<form runat=server>
<BR>
<asp:Panel id="Panel1" Height=50 Width=200 BackColor="Gainsboro"
Wrap="True" HorizontalAlign="Right" runat="server"/>
<h4>為上面的Panel選擇背景圖案:</h4>
<asp:image id="image1" ImageUrl="bg1.jpg" runat="server"/>
<asp:RadioButton id="Radio1"
Text="選擇此圖片作為Panel的背景圖片"
Checked="True"
AutoPostBack=True
GroupName="RadioGroup1"
runat="server" /><br>
<asp:image id="image2" ImageUrl="bg2.jpg" runat="server"/>
<asp:RadioButton id="Radio2"
Text="選擇此圖片作為Panel的背景圖片"
AutoPostBack=True
GroupName="RadioGroup1"
runat="server"/>
<br><BR>
<asp:RadioButtonList id=RadioButtonList1
AutoPostBack=True
CellPadding = "10" RepeatLayout = "Table"
RepeatColumns = "2"
runat="server">
<asp:ListItem>項目 1</asp:ListItem>
<asp:ListItem>項目 2</asp:ListItem>
<asp:ListItem>項目 3</asp:ListItem>
<asp:ListItem>項目 4</asp:ListItem>
<asp:ListItem>項目 5</asp:ListItem>
<asp:ListItem>項目 6</asp:ListItem>
</asp:RadioButtonList>
<asp:Label id="Label1" runat="server" />
<br><BR>
<asp:Button id="Button1"
Text="把RadioButtonList 移入到Panel中"
OnClick="SubmitBtn_Click"
runat=server/>
</form>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -