html禁止单选如何写,单选按钮禁用Html.textbox

我有2个收音机按钮Billable" Y" &安培;可结算" N"。它们连接到价值数据库" Y"或" N"。

如果Radio =" Y"然后需要禁用TextBox NonBillableReason。

如果Radio =" N"然后需要禁用TextBox NonBillableReason。

js。我在页面加载时工作正常我得到了正确的行为取决于无线电值" Y"或" N"。问题是我似乎无法单击单选按钮并更改禁用,true(或)禁用,false。

YES@Html.RadioButtonFor(model => model.Billable, "Y")

NO@Html.RadioButtonFor(model => model.Billable, "N")

@Html.TextBoxFor(model => model.NonBillableReason,new {@class = "form-control", @placeholder = "NOT BILLABLE BECAUS..."})

$(document).ready(function () {

if ($("#Billable:checked").val() == "Y") {

$("#NonBillableReason").attr("disabled", true);

}

if ($("#Billable:checked").val() == "N") {

$("#NonBillableReason").attr("disabled", false);

}

});

使用c#2017窗体一个学生基本信息注册基本控件如下1. private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e):当用户点击“用户协议”链接时,触发这个事件处理程序。 2. form1_Load(object sender, EventArgs e):窗体加载时调用这个方法。 3. comboBox1.SelectedIndex = 0;:将下拉框选中第一个选项。 4. button2.Enabled = checkBox1.Checked;:根据复选框状态启用或禁用按钮2。 5. info += "账号:" + textBox1.Text.Trim() + "\n";:将用户名拼接到消息框中。 6. info += "密码:" + textBox4.Text.Trim() + "\n";:将密码拼接到消息框中。 7. info += "性别:" + this.GetSexInput() + "\n";:将性别拼接到消息框中。 8. info += "生日:" + dateTimePicker1.Value.ToShortDateString() + "\n";:将生日拼接到消息框中。 9. info += "QQ:" + textBox1.Text.Trim() + "\n";:将QQ号拼接到消息框中。 10. info += "喜爱的编程:" + GetFaavorLangInput() + "\n";:将喜欢的编程语言拼接到消息框中。 11. info += "爱好:" + GetHobbiesInput() + "\n";:将爱好拼接到消息框中。 12. MessageBox.Show(info, "确认你的注册信息!");:弹出一个消息框显示所有输入的信息。 13. bool ValidateInput():定义了一个名为ValidateInput的方法用于验证输入的用户名、密码、性别、生日、QQ和喜欢的编程语言等信息是否正确。 14. string GetSexInput():定义了一个名为GetSexInput的方法用于获取用户的性别。 15. string GetFaavorLangInput():定义了一个名为GetFaavorLangInput的方法用于获取用户的喜欢的编程语言。 16. string GetHobbiesInput():定义了一个名为GetHobbiesInput的方法用于获取用户的爱好
06-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值