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
Solved

Create a calcuated gridview column

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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
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 a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 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