Click here to Skip to main content
15,851,701 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

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
ZurdoDev 22-Aug-14 8:34am    
Where are you stuck? You'll need to use the FindControl method to be able to access the updown control.
Member 10239837 22-Aug-14 8:38am    
i am stuck on how to implementing. can you help me with a code if thats possible

1 solution

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();

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900