62,041
社区成员
发帖
与我相关
我的任务
分享
TextBox txtPrice = (TextBox)e.Row.FindControl("txtPrice");
TextBox txtQuantity = (TextBox)e.Row.FindControl("txtQuantity");
TextBox txtTotalPrice = (TextBox)e.Row.FindControl("txtTotalMoney");
txtPrice.Attributes.Add("onkeyup", "alert(this.value)");
txtQuantity.Attributes.Add("onkeyup", "(this.value)");
TextBox txtPrice = (TextBox)e.Row.FindControl("txtPrice");
TextBox txtQuantity = (TextBox)e.Row.FindControl("txtQuantity");
TextBox txtTotalPrice = (TextBox)e.Row.FindControl("txtTotalMoney");
//写一个JS的方法, 传入三个文本框的客户端ID
txtPrice.Attributes.Add("onkeyup", "MyCalu('"+txtPrice.ClientID+"',
'"+txtQuantity.ClientID+"','"+txttotalPrice.ClientID+"')");
txtQuantity.Attributes.Add("onkeyup", "同上");
function MyCalu(p,q,t)
{
//根据传的ID取到三个文本框,其他的你自己应该会做了吧
var txtP=document.getElementById(p);//
}