Solved

Create a calcuated gridview column

Posted on 2013-06-18
3
453 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
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now