- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当选择其中一个时,我需要禁用其他 asp.net 单选按钮。共有三个单选按钮。例如选择了“现金”单选按钮,应禁用列表项中的其他两个。我做了一些研究,并且当选择第三个时,确实禁用了另外两个。但是在我的代码隐藏页面上,它为选定的单选按钮提供了空值。这是我的代码:
我的.aspx
<div class="col-sm-4" style="padding-top:4px ; margin-top:-8px">
<asp:RadioButtonList runat="server" ID="loanTypeCheck" CssClass="pull-right" RepeatDirection="Horizontal">
<asp:ListItem Value="Cash" Text=" Cash "/>
<asp:ListItem Value="Non-Cash" Text=" Non-Cash " />
<asp:ListItem Value="Dharauti" Text=" Dharauti " />
</asp:RadioButtonList>
</div>
我的代码背后
protected void SaveButton_Click(object sender, EventArgs e)
{
if (IsFormValidForSave())
{
var loanReceipt = GetLoanReceiptFromForm();
var transactionsDetails = new List<TransactionDetail>();
if (loanTypeCheck.SelectedValue == "Cash")
{
//
}
}
}
这是我的 JavaScript,用于禁用单选按钮
$('input[type=radio]').change(function () {
$("#<%=loanTypeCheck.ClientID %>").find('input').prop('disabled', true);
});
UI 中一切正常,但我在后面的代码中的 LoanTypeCheck.SelectedValue 中得到空值。
最佳答案
您可以使用 :not(:checked)
选择器禁用未选中的单选按钮:
$('#<%= loanTypeCheck.ClientID %>').change(function () {
$(this).find('input[type=radio]:not(:checked)').prop('disabled', true);
});
保持选中的单选按钮处于启用状态将允许回发所选值。
关于javascript - 如果选择了其中之一,则禁用 Asp.net RadioButtonList 中的其他 RadioButton,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38684437/
我一直在尝试使用 RadioButton 将另一个 RadioButton 变为可见。我是这个环境的新手,这是我的第一个 Windows Phone 应用程序。我的代码: private void
我有一个 GroupBox 和一堆 RadioButtons。当他们有焦点时,我可以使用向上/向下键来遍历它们。 但是,当我手动更改已选中的 RadioButton 并按向上/向下键时,迭代将从更改已
使用 WPF 和 MVVM 模式,我得到了一个动态填充单选按钮的列表框。
我有一个带有四个单选按钮的 RadioGroup,我让它们使用 4 的权重和在屏幕上均匀地隔开它们。这很好用,但结果是图形左对齐,而不是在每个单选按钮的中心。有没有办法将图形移动到中心?我尝试了重力中
我有 3 个单选按钮,用于对 API 中的不同数据进行排序。在每个单选按钮上,如果我按另一个单选按钮,单选按钮值就会消失,如下所示: 和 。我尝试使用属性绑定(bind) [value],但这导致了错
假设我有几个单选按钮和一些自定义对象作为数据源。 举个例子 public enum SomeModeType { firstMode = 10, secondMode = 20,
我正在尝试设置对单选组中第一个单选按钮的选择。在深入探讨这个问题之前,我需要指出问题仅发生在 API <= 16 中。当在模拟器或真实设备中运行 API 17 或更高版本时,一切正常。 它应该做什么
对于android编程,我有一个RadioGroup,其中包含一些RadioButtons。我只想从按钮获取文本,而不需要获取 RadioButton 的 id。
我编写了以下脚本,一旦单击要取消选中的其他复选框,它的工作正常,但是一旦我单击 tabkey,它就不会被选中或取消选中,它只会获得焦点, 脚本 function toggle(obj) { i
我有一个单选组,我可以在其中以编程方式添加单选按钮。这一切都是在 onCreateView() 方法中完成的,因此每次从后台堆栈重新创建 fragment 时都应该重做。我遇到的问题是,当我在开始时使
假设我在 RadioButtonGroup 中有一些 RadioButton。我单击其中一个,我意识到我不应该提交表单,相反,我只想触发取消操作并返回到我未选择的原始状态。我该怎么做? 最佳答案 想通
在我的布局中,我有一个 AppCompatRadioButton。使用 app:buttonTint 我将按钮设置为白色。如果我检查了 AppCompatRadioButton,圆圈的填充颜色也是白色
我正在开始使用 JavaFX,并且我已经构建了一个小俄罗斯方 block 游戏。现在一切正常,但最后我决定添加一组单选按钮来选择难度 - 这里我遇到了一个问题:突然LEFT/RIGHT/UP/DOWN
我的 RadioGroup 中的 RadioButton 在我取消选中它们或单击组中的另一个 RadioButton 后留下一个黑色的选中圆圈。我该如何防止这种情况发生?
在每个场景中,我都有多个切换组,每个切换组有两个单选按钮。无论我首先选择哪个场景上的哪个 RadioButton,听众都不会明白。它仍然为空,而不是保存设置的用户数据。如果我按第二次,它就会起作用。
我有一个有 2 个字段的应用程序:company_name 和 logo,我在 Model 的 Form 中显示像单选按钮这样的公司,但我想显示 logo 公司而不是公司标签(公司名称) 任何的想法
所以我想在我的应用程序中添加一个计算器。用户将首先单击适用于英制和公制单位的 RadioButton,然后根据用户单击的单选按钮,将出现其中一种布局。 如您所知,英制单位有英尺和英寸,为此我需要两个
我正在开发一个订单应用程序。如果实际时间在开放时间,则应将 rdi_now 的可见性设置为可见,否则设置为消失,因此用户在关闭时间只有选择预购的选项,但 rdi_preorder 没有做应该做的事情。
我在尝试单击时检查和取消选中单选按钮时遇到了一些问题。 我想做的是,当加载 Activity 时,单选按钮默认设置为选中。当用户按下选中的单选按钮时,我将单选按钮设置为取消选中并清空 TextView
我有三个单选按钮,我希望根据我单击的复选框上传我的 GUI。 我引用过本指南:http://docs.oracle.com/javafx/2/ui_controls/radio-button.htm这
我是一名优秀的程序员,十分优秀!