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;
}
}
<asp:TemplateField HeaderText="">
<ItemTemplate>
<asp:Button ID="btn_delete_row" runat="server" OnClientClick="qrowdetele(this)" Text="Delete Row" class="btn" />
</ItemTemplate>
</asp:TemplateField>
inside gridview pass the objcet this is javascript function and then javascript function. is this.
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: id of content palce holder in which girdview is (here is is a child page in master child page concept so no need in normal page)
grd_view: is the id of gridview
lbl_for_update_status: id of lable
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);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.