本文介绍了不能在JQuery中获取checkbox change()事件,而不是ID,而不是classname甚至无法在gridview中找到?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 以下是我的绑定gridview的代码,我已成功将其与复选框绑定,但现在无法获取网格中的复选框的复选框更改事件,提前我要在选定的第3列中计算2列行。 $。ajax({类型:POST, url:frmInvoice.aspx / LoadWithPOGrid, data:{},//{Param1:'+ PonoPos.toString()+'}, contentType:application / json, dataType:json,成功:函数(数据){调试器; if($ .trim(data.d [0] .PoNo) !=){ $($(#<% = gvWithPO.ClientID %> ))。empty(); $($(#<% = gvWithPO.Clien tID %> ))。append('< tr > < th 样式 = width:15px 宽度 = 15px > < / th > < th > PO否 < / th > < ; th > 采购单项目编号 < / th > < th > 项目代码< / th > < th > 项目描述< / th > < th > 投放日期< / th > &l t; th > 交货数量< ; / th > < th > 数量< / th > < th > 评分< / th > < th > 总< / th > < / tr > '); for(var i = 0; i < data.d.length; i ++) { debugger; var $ qty = $ .trim(data.d [I] .Qty); var $ rate = $ .trim(data.d [i] .Rate); var $ tbl =' < tr> < td Style =width:15pxWidth =15px>' + '' + '< input type = 复选框 id = chkRow class = chkRow runat = server / > '+ ''+ '< / td > < td > '+ $ .trim(数据。 d [i] .PoNo)+ '< / td > < td > '+ $ .trim(data.d [i] .PoLineItemNo)+ '< / td > < td > '+ $ .trim(data.d [i] .Item_Code)+ '< / td > < td > '+ $ .trim(data.d [i] .Item_Description)+ '< / td > < td > '+ $ .trim(data。 d [i] .Delivered_Date)+ '< / td > < td > '+ $ .trim(data.d [i] .Delivered_Qty)+ '< / td > < TD > < 输入 type = text id = txtQty class = txtQty maxlength = 10 占位符 = 数量 runat = server readonly = readonly style = text-align:right; width:90 % / > '+ '< / td > < td > < 输入 type = text id = txtRate class = txtRate maxlength = 10 占位符 = 评价 runat = server readonly = readonly style = text-align:right; width:90% / > '+ '< / td > < td > '+ $ .trim(data.d [i] .Total)+' < / td > < / tr > '; $(#<% = gvWithPO.ClientID %> ).append($ TBL); $(#<% = gvWithPO.ClientID %> tr:last ).find( 输入[类型=文本] [ID * = txtQty])VAL($修剪(data.d [I] .Qty。)); $(#<% = gvWithPO.ClientID %> tr:last ).find( 输入[类型=文本] [ID * = txtRate])VAL($修剪(data.d [I] .Rate。)); } }其他{调试器; 返回false; } },错误:function(){ alert(使用PO网格数据获取时出错); } })// Ajax LoadWithPOgrid 解决方案 .ajax({ type: POST, url:frmInvoice.aspx / LoadWithPOGrid, data:{},//{Param1:'+ PonoPos.toString()+'}, contentType:application / json, dataType:json, success:function(data){ debugger; if( .trim(data.d [0] .PoNo)!=){ ( following is my code to bind gridview ,I had successfully Binded it with checkbox but now am not able to get checkbox change event of checkbox which is in the grid ,ahead i want to do calculation of 2 column in 3rd column of selected row.$.ajax({ type: "POST", url: "frmInvoice.aspx/LoadWithPOGrid", data: {},//"{ Param1: '" + PonoPos.toString() + "'}", contentType: "application/json", dataType: "json", success: function (data) { debugger; if ($.trim(data.d[0].PoNo) != "") { $($("#<%=gvWithPO.ClientID%>")).empty(); $($("#<%=gvWithPO.ClientID%>")).append('<tr><th Style="width:15px" Width="15px"></th> <th>PO No</th><th>PO Line Item No</th><th>Item Code</th><th>Item Description</th><th>Delivery Date</th><th>Delivery Qty</th><th>Qty</th><th>Rate</th><th>Total</th></tr>'); for (var i = 0; i < data.d.length; i++) { debugger; var $qty = $.trim(data.d[i].Qty); var $rate = $.trim(data.d[i].Rate); var $tbl = '<tr> <td Style="width:15px" Width="15px">' + '' + '<input type="checkbox" id="chkRow" class="chkRow" runat="server" />' + '' + '</td><td>' + $.trim(data.d[i].PoNo) + '</td><td>' + $.trim(data.d[i].PoLineItemNo )+ '</td><td>' + $.trim(data.d[i].Item_Code) + '</td><td>' + $.trim(data.d[i].Item_Description) + '</td><td>' + $.trim(data.d[i].Delivered_Date) + '</td><td>' + $.trim(data.d[i].Delivered_Qty) + '</td><td> <input type="text" id="txtQty" class="txtQty" maxlength="10" placeholder="Qty" runat="server" readonly="readonly" style="text-align: right;width: 90%" />' + '</td><td> <input type="text" id="txtRate" class="txtRate" maxlength="10" placeholder="Rate" runat="server" readonly="readonly" style="text-align: right;width: 90%" />' + '</td><td>' + $.trim(data.d[i].Total) + '</td></tr>'; $("#<%=gvWithPO.ClientID%>").append($tbl); $("#<%=gvWithPO.ClientID%> tr:last").find("input[type=text][id*=txtQty]").val($.trim(data.d[i].Qty)); $("#<%=gvWithPO.ClientID%> tr:last").find("input[type=text][id*=txtRate]").val($.trim(data.d[i].Rate)); } } else { debugger; return false; } }, error: function () { alert("Error While fetching With PO grid data"); } })//Ajax LoadWithPOgrid 解决方案 .ajax({ type: "POST", url: "frmInvoice.aspx/LoadWithPOGrid", data: {},//"{ Param1: '" + PonoPos.toString() + "'}", contentType: "application/json", dataType: "json", success: function (data) { debugger; if (.trim(data.d[0].PoNo) != "") {( 这篇关于不能在JQuery中获取checkbox change()事件,而不是ID,而不是classname甚至无法在gridview中找到?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 11-03 07:21