我就是想同步更新 GridView中的数量当数量更新时。。合计也同时更新。。用了网上有的人的方法。。只能是统计没改之前的。。当我一点编辑是。就报异常。。说输入格式不正确。。我的数量,单价,合计在数据库中都是int,另外还有说RowUpdated事件写。但是我不会。。望高手相助protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string n = e.Row.Cells[2].Text;
            if ((!string.IsNullOrEmpty(n)))
            {
                n = "0";
            }
           int a = int.Parse(e.Row.Cells[2].Text);
            
            int b = int.Parse(e.Row.Cells[3].Text);
            int s = b*a;
            e.Row.Cells[4].Text = s.ToString(); 
            StringBuilder script = new StringBuilder();            //输入数值之后总自动金额更新
            script.Append(" var amount=0;");
            script.Append(" vAmt=document.getElementById('" + e.Row.Cells[4].ClientID + "');");
            script.Append(" vNum=document.getElementById('" + e.Row.Cells[2].ClientID + "');");
            script.Append(" vPrice=document.getElementById('" + e.Row.Cells[3].ClientID + "');");
            script.Append("var amt=parseFloat(vPrice.value)*parseFloat(vNum.value);");
            script.Append("vAmt.value=amt;");
            e.Row.Cells[3].Attributes.Add("onblur", script.ToString());
            e.Row.Cells[2].Attributes.Add("onblur", script.ToString());
           //e.Row.Cells[4].Text = int.Parse(e.Row.Cells[2].Text) * int.Parse(e.Row.Cells[3].Text);
           //e.Row.Cells[4].Text = decimal.Parse(decimal.Parse(e.Row.Cells[2].Text) * decimal.Parse(e.Row.Cells[3].Text)).ToString();        }
    }