请考虑以下情况:
我有一个带有3个下拉列表的表单。我将这些控件放在update panel
中。当我的用户在第一个下拉列表中选择一个值大于2的Item时,我禁用了jQuery的第二个和第三个下拉列表。我的问题是启用所有后退所有下拉列表后,我知道这是正常现象,但是如何再次检查表单并禁用应禁用的控件?
谢谢
编辑1)
这是我的代码:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:DropDownList ID="DropDownList1" runat="server" Width="100px">
<asp:ListItem Value="1" Text="1" />
<asp:ListItem Value="2" Text="2" />
<asp:ListItem Value="3" Text="3" />
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:DropDownList ID="DropDownList2" runat="server" Width="100px">
<asp:ListItem Value="1" Text="1" />
<asp:ListItem Value="2" Text="2" />
<asp:ListItem Value="3" Text="3" />
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:DropDownList ID="DropDownList3" runat="server" Width="100px">
<asp:ListItem Value="1" Text="1" />
<asp:ListItem Value="2" Text="2" />
<asp:ListItem Value="3" Text="3" />
</asp:DropDownList>
<br />
</td>
</tr>
</table>
<div>
<asp:Button ID="Button1" runat="server" Text="Cause Post Back" Width="200px"
onclick="Button1_Click"/>
</div>
</ContentTemplate>
</asp:UpdatePanel>
和javascript:
$(document).ready(function () {
function Disable(item) {
item.attr('disabled', 'disabled');
}
$('#DropDownList1').change(function () {
if ($(this).val() > 2) {
Disable($('#DropDownList2'));
Disable($('#DropDownList3'));
}
else {
Enable($('#DropDownList2'));
Enable($('#DropDownList3'));
}
}).change();
function Enable(item) {
item.removeAttr('disabled');
}
});
c#参考方案
我想念什么吗?
$('#dropdown1').change(function()
{
if ( $(this).val() > 2 )
{
$('#dropdown2, #dropdown3').prop('disabled', true);
}
else
{
$('#dropdown2, #dropdown3').prop('disabled', false);
}
})
.change();
与Mootools Scriptmanager Ajax Asp.net发生冲突? - c#我正在尝试不同的方法来使这项工作成功,但是没有成功。我正在尝试将mootools与asp.net应用程序集成。我只想用它为我的网站添加一些效果。我也使用更新面板,scriptmanager,因为不希望有完整的回发。在控制台上引发错误TypeError:clientID.startsWith不是函数,并且在进行更新时brwoser reset...。这是整个代…
将python scikit学习模型导出到pmml - python我想将python scikit-learn模型导出到PMML。哪个python软件包最合适?我阅读了有关Augustus的内容,但是我无法使用scikit-learn模型找到任何示例。 python大神给出的解决方案 SkLearn2PMML是 JPMML-SkLearn命令行应用程序周围的薄包装。有关受支持的Scikit-Learn Estimator和…
如何使用PHP从动态输入字段捕获数组值? - javascript我正在编写一个在线时间跟踪网页,允许用户将学习时间输入该系统。用户将首先输入名称,然后根据日期输入学习时间。一天中可能会有多个学习时间。以下是我第一页的编码,<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"…
在laravel中应用ajax - javascript我想在laravel 4.2中应用ajax。我想重定向到页面而不重新加载它。我已经尝试过使用window.loaction.href和window.loaction.assign了,但是它不起作用。这是我的文件Route.php //login+logout+auth Route::get('login','authentica…
将简单的javascript代码转换为c# - javascript昨天我在这里问了一个问题。使用javascript和html解决方案很简单前一阵子我打算什么是操纵html来执行javascript中的任务但是我改变了主意,将javascript代码重写为c#这是输入<Abstract> <Heading>Abstract</Heading> <Para TextBreak=…