I came across this functionality where I need a simple arithmetic calculation in two columns of a GridView.
So, let's start with it.
Step 1
We would first create a simple ASP.NET Web Application and add a blank page to it.

Step 2
Now add an ASP.NET GridView to the page and provide the following columns to it. Now, the fields would be Bound Fields except the one using that we are selecting the required operator.
Now, we add some dummy data to this GridView on the page load of the page so as to proceed.
After this the screen looks as in the following:
Now we add a button called a Compute Button to the page. After selecting the operator, when the user clicks the compute button, value1 and value2 would be computed depending on the operator and the result will be displayed in the Result column of the GridView.
The final output screen comes out to be the following:
The code works in the way such that for each row in the GridView, the value1 and value2 are taken and operated on and the same is then displayed in the Result Column. On clicking the button, the output appears to be the following:
To provide more insight into the code, I have attached the solution to this article. I hope it helped you.
Thanks.
Implementing Arithmetic Calculations in GridView
Learn how to perform arithmetic operations on two values in each ASP.NET GridView row and display the result when a button is clicked.


Asfend YarPosted Feb 29, 2016, 9:12 AM EST
Sr Karthiga please post single comment on the article
Asfend YarPosted Feb 29, 2016, 9:12 AM EST
good
Sr KarthigaPosted Feb 26, 2016, 4:36 AM EST
good one
Sr KarthigaPosted Feb 26, 2016, 4:36 AM EST
nice explanation
Vipul MalhotraPosted Sep 17, 2015, 3:44 AM EDT
Welcome
Pavithra LPosted Sep 17, 2015, 3:33 AM EDT
Its working thanks for your help.....
Vipul MalhotraPosted Sep 17, 2015, 12:13 AM EDT
Thanks Akash
Akash MalhotraPosted Sep 3, 2015, 11:13 AM EDT
Nice article
Santhakumar MunuswamyPosted Jul 30, 2015, 6:56 AM EDT
Good article. Thanks for sharing
Shridhar SharmaPosted Jul 29, 2015, 6:36 AM EDT
good one.
Jacob RobinsonPosted Jul 29, 2015, 6:34 AM EDT
Good Show..
RakeshPosted Jul 29, 2015, 5:48 AM EDT
Nice one
Gopi ChandPosted Jul 29, 2015, 4:58 AM EDT
Well done
pooja guptaPosted Jul 29, 2015, 3:17 AM EDT
nice article sir
Nilesh JadavPosted Jul 29, 2015, 2:46 AM EDT
Nice article sir
Neeraj KumarPosted Jul 29, 2015, 2:45 AM EDT
Nice
Pankaj Kumar ChoudharyTOP 100Posted Jul 29, 2015, 2:21 AM EDT
Nice One......
Sibeesh VenuTOP 100Posted Jul 29, 2015, 2:07 AM EDT
Nice Share.
Rajeesh MenothPosted Jul 29, 2015, 2:03 AM EDT
Good One..