日期:2014-05-18  浏览次数:20808 次

C#在DATAGRIDVIEW中如何使一列=A列*B列,求救啊.A列,B列都是手工录入的
用什么事件,代码怎样写,,,,,,头痛
C#在DATAGRIDVIEW中如何使一列=A列*B列,求救啊.A列,B列都是手工录入的

------解决方案--------------------
C# code

    protected void DataGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        try
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Cell[2].Text= (Convert.ToInt32(e.Row.Cell[0].Text)*Convert.ToInt32(e.Row.Cell[1].Text)).ToString();
            }
        }
        catch (Exception ex)
        {
        }
    }