protected void fpPo_ButtonCommand(object sender, FarPoint.Web.Spread.SpreadCommandEventArgs e)
{
if (e.CommandName == "dataChanged")
{
int iCol = fpPo.Sheets[0].ActiveColumn;
int iRow = fpPo.Sheets[0].ActiveRow;
SID_Ocx.SID_Cls mCls = new SID_Ocx.SID_Cls();
if (iCol == (int)VL.qty || iCol == (int)VL.unit_price)
{
double dblAmt = mCls.Fun_ToNumeric(fpPo.Sheets[0].Cells[iRow, (int)VL.qty].Text) * mCls.Fun_ToNumeric(fpPo.Sheets[0].Cells[iRow, (int)VL.unit_price].Text);
fpPo.Sheets[0].Cells[iRow, (int)VL.amt].Text = dblAmt.ToString();
fpPo.SaveChanges();
}
Fun_SumAmt();
}
}
private void Fun_SumAmt()
{
double dblAmt = 0, dblQty = 0;
for (int i = 0; i < fpPo.Sheets[0].RowCount; i++)
{
dblAmt += mCls.Fun_ToNumeric(fpPo.Sheets[0].Cells[i, (int)VL.amt].Text);
dblQty += mCls.Fun_ToNumeric(fpPo.Sheets[0].Cells[i, (int)VL.qty].Text);
}
txtTotalAmt.Text = dblAmt.ToString();
txtTotalQty.Text = dblQty.ToString();
fpTotal.Sheets[0].Cells[0, (int)VL.qty].Text = dblQty.ToString();
fpTotal.SaveChanges();
}
protected void btnRef_Click(object sender, EventArgs e)
{
Fun_SumAmt();
}
你好,请问下,我在ButtonCommand中计算出当前行的金额,并调用sumAMT求到总金额,想显示到另一个网格fpTotal中,但显示不出来,但我用btnRef单击时去调用就可以,不知道是怎么回事,请指点! |
|