<asp:RadioButton Text="男" ID="RadioButton1" GroupName="sex" runat="server" />
<asp:RadioButton Text="女" GroupName="sex" ID="RadioButton2" runat="server" /><br />
<asp:Label ID="Label4" runat="server" Text="爱好"></asp:Label>:
String a = this.RadioButton1.Checked == true ? "男" : "女";
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem Value="男"></asp:ListItem>
<asp:ListItem Value="女"></asp:ListItem>
</asp:RadioButtonList>
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
<asp:ListItem Value="唱歌" ></asp:ListItem>
<asp:ListItem Value="舞蹈"></asp:ListItem>
<asp:ListItem Value="游泳"></asp:ListItem>
</asp:CheckBoxList>
<br />
城市:
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Selected="True" Value="北京"></asp:ListItem>
<asp:ListItem Value="广州"></asp:ListItem>
<asp:ListItem Value="上海"></asp:ListItem>
</asp:DropDownList>
string radio1 = "";
for (int i = 0; i < this.RadioButtonList1.Items.Count; i++)
{
if (this.RadioButtonList1.Items[i].Selected == true)
{
radio1 += this.RadioButtonList1.Items[i].Value + ",";
}
}
string str_Save_cblJL = "";
foreach (ListItem li in cblJL.Items)
{
if (li.Selected == true)
{
str_Save_cblJL += li.Value + ",";
}
}
Response.Write(str_Save_cblJL);