如何使用javascript计算keypress事件上的GridView模板列 [英] How to make calculation of GridView Template columns on keypress events using javascript

查看:63
本文介绍了如何使用javascript计算keypress事件上的GridView模板列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个包含4个文本框列的gridview。在输入值时,需要进行计算并将值设置为另一个文本框模板字段gridview。



我需要



1.计算NetAmount =(Rate * Qty)-Tax% -Disc%

2.净额的总和必须在页脚模板字段中显示。

3.我必须使用javascript在文本框的按键事件上进行这些计算。 。









请帮帮我......


提前致谢..



Vineetha

解决方案

< blockquote> //在页面加载上添加此代码

txtboxFirstName.Attributes.Add(onKeyPress,javascript:onCC_Changed();)





//然后IT在javascript上调用函数Name onCC_Changed()你可以为GridView Calculation添加你的代码。







var GridView = document.getElementById(gridid);

var inputList = GridView.getElementsByTagName(input);

for(var i = 0;我< inputList.length; i ++){



//GridView.rows[i].cells[1].innerHTML



if(inputList [i] .type ==" checkbox"){

if(inputList [i] .checked){



//这里你可以添加你的更改





}

}

}

hi,

I have a gridview with 4 textbox columns.while entering the value, need to make calculation and set value to an another textbox template field in that gridview.

I need

1. to calculate NetAmount = (Rate * Qty)-Tax%-Disc%
2. Sum of net amount must be show in footer template field.
3.I have to make these calculation on key press event of textbox using javascript..




Please help me...

Thanks in advance..

Vineetha

解决方案

//Add this Code on the Page Load
txtboxFirstName.Attributes.Add ("onKeyPress", "javascript:onCC_Changed();")


//Then IT Calls the function Name onCC_Changed() on the javascript here u can Add ur Code for GridView Calculation.



var GridView = document.getElementById(gridid);
var inputList = GridView.getElementsByTagName("input");
for (var i = 0; i < inputList.length; i++) {

//GridView.rows[i].cells[1].innerHTML

if (inputList[i].type == "checkbox") {
if (inputList[i].checked) {

//here u can Add ur changes


}
}
}


这篇关于如何使用javascript计算keypress事件上的GridView模板列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆