我在使用 jQuery 时遇到问题。当我开始在txtiPercentage
textbox 中写作时,txtDollarAmtinfo
应该只为该特定行禁用文本框。
<gridview ID="BulkEditGridView1"
runat="server"
AutoGenerateColumns="False"
DataKeyNames="Pk_PropertyID">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="txtiPercentage"
Text='<%#Eval("BidPercentage","{0:0.000}") %>'
runat="server"
onKeyDown="OnKeyDownHandler(this,event)"></asp:TextBox>
<asp:TextBox ID="txtDollarAmtinfo"
Text='<%#Eval("BidDollarAmt","{0:0,00}") %>'
runat="server" ></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</gridview>
脚本:
<script type="text/javascript">
function OnKeyDownHandler(thisobj,e) {
var newid = $(thisobj).attr('id');
$(thisobj).closest('tr')
.find("input[id$="txtDollarAmtinfo"]:not(input[id$=' + newid + '])')
.attr("disabled", "disabled")");
}
</script>