2011-05-31 133 views
0
 function ValidateText(i) { 
      if (i.value.length > 0) { 
       i.value = i.value.replace(/[^\d]+/g, ''); 
       var yourBoundColumnValue = i.parentNode.previousSibling.childNodes[0].nodeValue; 
       var total = 0;    
       var tot = document.getElementById('<%=lblBalQty.clientId %>').innerHTML 
       alert(Number(tot)); 
       tot.innerHTML = i.value; 
       tot.innerHTML = yourBoundColumnValue - i.value; 
      } 
     } 
+0

plz格式ur codez。 – alex 2011-05-31 06:06:12

+0

欢迎来到SO,在发布你的问题之前,使用代码部分粘贴你的代码。 – 2011-05-31 06:08:31

+0

是服务器端或客户端的错误,也可能是在大块代码之后的小代码片段中缺少数字“1”,这意味着应该是<%= lblBalQty1.clientId% >'而不是'<%= lblBalQty.clientId%>'? – Triztian 2011-05-31 06:13:05

回答

0
function calculate(object) { 

     var _name = object.id; 
     var New = _name.split('_'); 
     if (object.value.length > 0) { 
      object.value = object.value.replace(/[^\d]+/g, ''); 
     } 
     var _ans = 0; 
     var _num1 = document.getElementById(New[0] + "_" + New[1]+ "_" + New[2] + "_" + New[3] + "_txtSupQty").value; 
     if (_num1 == 'NaN' || _num1=='') { 
      _num1 = 0; 
     } 
     var yourBoundColumnValue = object.parentNode.previousSibling.childNodes[0].nodeValue; 
     if (parseInt(_num1) >= 0 && _num1 != 'NaN') { 
      _ans = parseInt(yourBoundColumnValue)-parseInt(_num1); 
     } 
     document.getElementById(New[0] + "_" + New[1] + "_" + New[2] + "_" + New[3] + "_lblBalQty").innerHTML = parseFloat(_ans);     
    }         
+0

这解决了这个问题 – Prashant 2011-06-01 07:25:51

0
<asp:TemplateField HeaderText=""> 

<ItemTemplate> 
<asp:Button ID="btn_delete_row" runat="server" OnClientClick="qrowdetele(this)" Text="Delete Row" class="btn" /> 

              </ItemTemplate> 
        </asp:TemplateField> 

里面的GridView通过objcet这是javascript函数,然后 javascript函数。这是。

function qrowdetele(rowobject) 
     { 
      var row = rowobject.parentNode.parentNode; 
      var rowIndex = row.rowIndex - 1; 

      //getting data 
      var lablevalue= document.getElementById("ContentPlaceHolder1_grd_view_lbl_for_update_status_"+rowIndex)[0].value; 

      alert("RowIndex: " + rowIndex + "lable value:" +lablevalue); 

//setting data 
     document.getElementById("ContentPlaceHolder1_grd_view_lbl_for_update_status_" + rowIndex)[0].value = "MarkedForDeletion"; 



     } 

ContentPlaceHolder1_grd_view_lbl_for_update_status_

ContentPlaceHolder1:内容。安迪持有人在girdview是ID(这里是在主子页概念的子页面,以便在正常的页面没有必要)

grd_view:是gridview的ID

lbl_for_update_status:标识的ID

相关问题