Solved

Create a calcuated gridview column

Posted on 2013-06-18
3
452 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
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

771 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

16 Experts available now in Live!

Get 1:1 Help Now