计算Gridview中NumericUpDown控件中的值的总和 [英] Calculate the total sum of values in the NumericUpDown Control in Gridview

查看:71
本文介绍了计算Gridview中NumericUpDown控件中的值的总和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好



i有一个gridview,它由4列组成,第四个有一个NumericUpDown控件,用户为gridview中的每一行选择一个数字



现在我希望用户完成后点击按钮来计算numericUpDown中的值,他输入的值



并在Label中显示值

Hello

i have a gridview which consists of 4 columns and the fourth one has a NumericUpDown control which the user selects a number for each of the rows in the gridview

now i want the user when he is done click the button to calculate the values that are in the numericUpDown, the values he entered

and display the value in the Label

推荐答案

protected void btnCalculate_Click(object sender, EventArgs e)
        {
            decimal actualMark = 0;
            if (grdJudgingMarksheet.Rows.Count > 0)
            {
                for (int i = 0; i < grdJudgingMarksheet.Rows.Count; i++)
                {
                    actualMark = actualMark + Convert.ToDecimal(((TextBox)grdJudgingMarksheet.Rows[i].FindControl("txtMarks")).Text.ToString());

                }
            }
            grdJudgingMarksheet.Columns[3].FooterText = actualMark.ToString();

        }


这篇关于计算Gridview中NumericUpDown控件中的值的总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆