2011-05-31 105 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

相關問題