protected void grdAll_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label   lblServiceCharge = (Label)e.Row.FindControl("lblServiceCharge");
                Label   lblServiceTax    = (Label)e.Row.FindControl("lblServiceTax");
                Label   lblTotalamt      = (Label)e.Row.FindControl("lblTotalamt");
                decimal lblcharge        = Convert.ToDecimal(lblServiceCharge.Text);
                decimal lblTax           = Convert.ToDecimal(lblServiceTax.Text);
                decimal lblamont         = Convert.ToDecimal(lblTotalamt.Text);
                ServiceCharge += lblcharge;
                Tax           += lblTax;
                TotalAmt      += lblamont;
            }

            if (e.Row.RowType == DataControlRowType.Footer)
            {
                e.Row.Cells[0].Font.Bold = true;
                e.Row.Cells[1].Font.Bold = false;
                if (txtFromDate.Text != "" && txtTodate.Text != "")
                {
                    Label lblcountry = (Label)e.Row.FindControl("lblfooterCountry");
                    lblcountry.Text = string.Empty;
                }
                Label lblCharge = (Label)e.Row.FindControl("lblCharge");
                lblCharge.Text = ServiceCharge.ToString();
                Label lblTax = (Label)e.Row.FindControl("lblTax");
                lblTax.Text = Tax.ToString();
                Label lblGrandtotl = ((Label)e.Row.FindControl("lblGrandtotl"));
                lblGrandtotl.Text = TotalAmt.ToString();
            }
        }
        private string Validate(string propertyName)
        {
            // Return error message if there is error on else return empty or null string
            string validationMessage = string.Empty;

            if (_firstLoad)
            {
                return(validationMessage);
            }
            switch (propertyName)
            {
            case "Sector":     // property name
                if (string.IsNullOrWhiteSpace(Sector))
                {
                    validationMessage = "No Sector Available";
                }
                break;

            case "Collection":     // property name
                if (string.IsNullOrWhiteSpace(Collection))
                {
                    validationMessage = "No Collection Type Available";
                }
                break;

            case "Amount":
                if (!double.TryParse(Amount.ToString(), out uselessParse))
                {
                    validationMessage = "Only Digits Are Allowed";
                }
                break;

            case "ServiceCharge":
                if (!double.TryParse(ServiceCharge.ToString(), out uselessParse))
                {
                    validationMessage = "Only Digits Are Allowed";
                }
                break;

            case "Installment":
                if (!double.TryParse(Installment.ToString(), out uselessParse))
                {
                    validationMessage = "Only Digits Are Allowed";
                }
                break;

            case "InstallmentAmount":
                if (!double.TryParse(InstallmentAmount.ToString(), out uselessParse))
                {
                    validationMessage = "Only Digits Are Allowed";
                }
                break;

            case "ID":
                break;
            }

            return(validationMessage);
        }
示例#3
0
        private string Validate(string propertyName)
        {
            // Return error message if there is error on else return empty or null string
            string validationMessage = string.Empty;

            if (_firstLoad)
            {
                return(validationMessage);
            }
            switch (propertyName)
            {
            case "Deposit":
                if (!double.TryParse(Deposit.ToString(), out uselessParse))
                {
                    validationMessage = "Only Digits Are Allowed";
                }
                break;

            case "Interest":
                if (!double.TryParse(Interest.ToString(), out uselessParse))
                {
                    validationMessage = "Only Digits Are Allowed";
                }
                break;

            case "Withdraw":
                if (!double.TryParse(Withdraw.ToString(), out uselessParse))
                {
                    validationMessage = "Only Digits Are Allowed";
                }
                break;

            case "ServiceCharge":
                if (!double.TryParse(ServiceCharge.ToString(), out uselessParse))
                {
                    validationMessage = "Only Digits Are Allowed";
                }
                break;
            }

            return(validationMessage);
        }