如何在asp.net(vb.net)中制作两个复选框Mutually Exclusive [英] how to make two check box Mutually Exclusive in asp.net(vb.net)
本文介绍了如何在asp.net(vb.net)中制作两个复选框Mutually Exclusive的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨每一个我有一个简单的Web应用程序,有一些复选框,我想让其中两个互斥,然后我写保护子CheckBox3_CheckedChanged事件和受保护的子CheckBox4_CheckedChanged这段代码:
hi every one I have a simple web application that has some check boxes I want make two of them Mutually Exclusive then I write on Protected Sub CheckBox3_CheckedChanged event and Protected Sub CheckBox4_CheckedChanged this code :
If CheckBox4.Checked = True Then CheckBox3.Checked = False
If CheckBox3.Checked = True Then CheckBox4.Checked = False
但它不起作用
你可以帮助我!
but it is not work
can u help me !
推荐答案
虽然可以通过连接CheckedChanged来完成,但我建议使用RadioBu tton [ ^ ]。使用复选框,用户希望单独的复选框通常独立工作,因此如果用户的选择是多个选项的单一选项,那么使用单选按钮是一个好习惯
While this could be done by wiring the CheckedChanged as you have tried, I would suggest using RadioButton[^] instead. With check boxes the user expects that individual check boxes typically work independently so if the choice for the user is a single choice from multiple options, then it's a good practice to use radio buttons
使用RadioButton (或单选按钮列表)比使用复选框更有意义。
尝试
Radiobutton类 [ ^ ]
单选按钮列表 [ ^ ]
Using RadioButton (or Radio Button List) makes more sense than using a checkbox.
Try
Radiobutton class[^]
Radio Button List[^]
这篇关于如何在asp.net(vb.net)中制作两个复选框Mutually Exclusive的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文