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.
30 Comments
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment.

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