Solved

Create a calcuated gridview column

Posted on 2013-06-18
3
457 Views
Last Modified: 2013-06-19
I need a calculated column that is based on two databound columns

Can I add a new databound column that is a function of 2 other defined databound columns?

Databound Column Data=Price   // This displays properly as a column in the gridview

Databound Column Data=Tax     // This displays properly as a column in the gridview

Databound Column Data=Price + Tax  ??  // Error

If not, what do you suggest?

Is a template field the way to do this?

Thanks,
0
Comment
Question by:Dovberman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 8

Assisted Solution

by:johny_bravo1
johny_bravo1 earned 100 total points
ID: 39258174
Template Field will give you more control on the Gridview as you expected.
OnItemDataBound  you can access the fields and do your stuff!!
0
 
LVL 12

Accepted Solution

by:
duttcom earned 200 total points
ID: 39258187
Does the third column actually exist in your database? If so it can be databound, but if not, the field can't be databound because there is nothing for the data to be bound to. Do you just want to display Price + Tax in the gridview but not necessarily save it to the database?

If the third column does exist in the database, you could set it up as a derived column so that the database itself calculates the value from the other two fields and displays it in your gridview. Of course this depends on your data source (which is?).
0
 

Author Closing Comment

by:Dovberman
ID: 39259215
Thank you
0

Featured Post

Stressed Out?

Watch some penguins on the livecam!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question