Ejemplo n.º 1
0
    protected override void OnLoadComplete(EventArgs e)
    {
        base.OnLoadComplete(e);
        decimal totalFee = 0;
        Label   lblSum   = (Label)SKUListView.FindControl("lblSum");

        for (int i = 0; i < this.SKUListView.Items.Count; i++)
        {
            foreach (GridViewRow row in ((GridView)this.SKUListView.Items[i].FindControl("gvExpense")).Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    TextBox txtAccruedAmount = (TextBox)row.FindControl("txtAccruedAmount");
                    if (string.IsNullOrEmpty(txtAccruedAmount.Text.Trim()))
                    {
                        txtAccruedAmount.Text = "0";
                    }
                    decimal accruedAmount = decimal.Parse(txtAccruedAmount.Text.Trim());
                    totalFee = totalFee + accruedAmount;
                }
            }
        }
        lblSum.Text = totalFee.ToString("N");
        //if (this.gvApplyDetails.Rows.Count > 0) {
        //    foreach (GridViewRow item in gvApplyDetails.Rows) {
        //        if (item.RowType == DataControlRowType.DataRow) {
        //            TextBox textBox = (TextBox)item.FindControl("txtAccruedAmount");
        //            total += decimal.Parse(textBox.Text == string.Empty ? "0" : textBox.Text.ToString());
        //        }
        //    }
        //}
        //Label lblTotal = (Label)gvApplyDetails.FooterRow.FindControl("totallbl");
        //lblTotal.Text = total.ToString("N");
    }
Ejemplo n.º 2
0
    protected void SKUListView_OnDataBound(object sender, EventArgs e)
    {
        Label lblSum = (Label)SKUListView.FindControl("lblSum");

        if (this.ViewState["ManualApplyFeeTotal"] != null)
        {
            lblSum.Text = this.ViewState["ManualApplyFeeTotal"].ToString();
        }
        else
        {
            lblSum.Text = "0";
        }
    }