我在这个问题上需要帮助我复选框几天,甚至我选中了复选框 要知道在C#中,如果每次返回false都是真或假,请查看下面的代码。 请帮忙
BootStrap代码
<form class="form-horizontal" role="form">
<div class="checkbox checkbox-primary">
<input runat="server" id="checkStar" type="checkbox" data-provide="checkbox" />
<label for="checkbox2">Saturday</label>
</div>
<div class="checkbox checkbox-primary">
<input runat="server" id="checkSun" type="checkbox"/>
<label for="checkbox2">Sunday</label>
</div>
<div class="checkbox checkbox-primary">
<input runat="server" id="checkmon" type="checkbox" />
<label for="checkbox2">monday</label>
</div>
<div class="checkbox checkbox-primary">
<input runat="server" id="chectu" type="checkbox"/>
<label for="checkbox2">tuesday</label>
</div>
<div class="checkbox checkbox-primary">
<input runat="server" id="checwe" type="checkbox"/>
<label for="checkbox2">thursday</label>
</div>
</form>
C#代码
if (checkStar.Checked == false & checkmon.Checked == false & chectu.Checked == false & checwe.Checked == false)
{
textbox1.text="please select one day";
retuern;
}
答案 0 :(得分:0)
尝试
if (!checkStar.Checked && !checkmon.Checked && !chectu.Checked && !checwe.Checked)
{
textbox1.text="please select one day";
return
}