asp.net中RadioButtonList每次只能选择一个并写入数据库
前台:
<asp:RadioButtonList ID="RadioButtonList1" runat="server"
RepeatDirection="Horizontal"><asp:ListItem Value="0">未做任何处理</asp:ListItem>
<asp:ListItem Value="1">已派技术员上门</asp:ListItem>
<asp:ListItem Value="2">故障已修复</asp:ListItem>
<asp:ListItem Value="3">故障没有修复</asp:ListItem>
<asp:ListItem Value="4">反修复</asp:ListItem>
</asp:RadioButtonList>
后台:
ZYWEB.BLL.OA_services bll = new ZYWEB.BLL.OA_services();
ZYWEB.Model.OA_services model = new ZYWEB.Model.OA_services();
读取数据
public void BindData()
{
RadioButtonList1.SelectedValue = model.state.ToString();
}
保存到数据库
protected void Button3_Click(object sender, EventArgs e)
{
model.state = RadioButtonList1.SelectedValue;
bll.Update(model);
}