0

我有GridView一列显示成本。我想总结这笔费用并显示为账单金额。应按adding/deleting连续计费金额updated

我正在使用asp .net c#.

4

2 回答 2

2

您应该在rowDataBound事件中执行此操作,您将能够访问cell当前绑定的行中的每一个并将这些值相加到 avariable中。

另一种方法是直接从Database

于 2013-07-03T12:00:28.627 回答
-1
protected void txtUnitPrice_TextChanged(object sender, EventArgs e)
{
    try
    {
        DataSet dset3 = new DataSet();
        GridViewRow currentRow = (GridViewRow)((TextBox)sender).Parent.Parent;
        TextBox qty = (TextBox)currentRow.FindControl("txtqty");
        TextBox qty1 = (TextBox)currentRow.FindControl("txtUnitPrice");
        string a = qty.Text;
        TextBox totalprice = (TextBox)currentRow.FindControl("txttotal");
        totalprice.Text = (Double.Parse(qty1.Text) * Double.Parse(qty.Text)).ToString();

    }
    catch (Exception ex)
    {

    }

}
于 2014-11-21T09:44:11.690 回答