.net中单选按钮RadioButton,RadioButtonList 以及纯Html中radio的用法实例?

http://www.cnblogs.com/summers/archive/2013/07/31/3227234.html

.net中单选按钮RadioButton,RadioButtonList 以及纯Html中radio的用法,区别?


RadioButton实例及说明:

<asp:RadioButton ID="publicHas" Checked="true" runat="server" CssClass="radioMiddle" Text="所有人可见" GroupName="mm"/>

<asp:RadioButton ID="privateHas" runat="server" CssClass="radioMiddle" Text="仅自己可见" GroupName="mm" />

<asp:RadioButton ID="friendHas" runat="server" CssClass="radioMiddle" Text="仅好友可见" GroupName="mm" />

.net后台处理方式:
if (privateHas.Checked == true)
model.Limits = 0;
if (friendHas.Checked == true)
model.Limits = 1;
if (publicHas.Checked == true)
model.Limits = 2;


RadioButtonList在.net中跟DropDownList用法相似,可以看成集合:
<asp:RadioButtonList ID="rbImg" Name="rbImg" runat="server" RepeatDirection="Horizontal"
RepeatLayout="Flow">
<asp:ListItem Value="1">是</asp:ListItem>
<asp:ListItem Value="0" Selected="True">否</asp:ListItem>
</asp:RadioButtonList>


.net后台处理方式:

this.radCid.SelectedValue = project.Cid;


radio
将name设置为相同的值
<input type="radio" name="sex" value="1" checked="checked"></input>男
<input type="radio" name="sex" value="0" ></input>女


.net后台处理方式:
通过Request.Form["sex"].ToString();获取

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值