订单编号1: 价格xx元,数量y
订单编号2: 价格xx元,数量y
订单编号5: 价格xx元,数量y
订单编号18: 价格xx元,数量y
订单编号9: 价格xx元,数量y
我想统计这几个编号的总价!如何逐条获取并统计总价呢!拜托各位了!xx和y是随便什么值!没分了不好意哦!
问题补充:
:public partial class jiesuan : System.Web.UI.Page
{
orderList o = new orderList();
orderListDBLL od = new orderListDBLL();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GridView1.DataSource = od.QryorderList();
GridView1.DataBind();
}
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
int total = 0;
if (e.Row.RowType == DataControlRowType.DataRow)
{//这三行没执行
int price = int.Parse(e.Row.Cells[1].Text);
int num = int.Parse(e.Row.Cells[2].Text);
total += price * num;
}
else if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[0].Text = "总计";
e.Row.Cells[2].Text = total.ToString();
}
}
}
沐紫菀
|
初学一级
|
园豆:
1
提问于:2009-12-20 21:05