?
Solved

Create a calcuated gridview column

Posted on 2013-06-18
3
Medium Priority
?
460 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 400 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 800 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

765 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