How to add calculated columns to a GridView?

S

SammyBar

Hi,

I'm trying to display a DataSet data by using a GridView control on Visual
Studio 2005 professional. I'm displaying the DataSet directly, without using
the DataSource object. I can display selected columns from my DataSet, but I
need to display a grid column wich is the result of manipulating some
DataSet columns.
Obviously I can make the DataSet's table to include the needed column
precalculated and filled. But it means to couple the dataset to the grid
needs and I'd prefer to mantain the DataSet independent of the presentation
layer.
How can I do that?

Any hint is welcomed
Thanks in advance
Sammy
 
S

Stan

Hi,

I'm trying to display a DataSet data by using a GridView control on Visual
Studio 2005 professional. I'm displaying the DataSet directly, without using
the DataSource object. I can display selected columns from my DataSet, but I
need to display a grid column wich is the result of manipulating some
DataSet columns.
Obviously I can make the DataSet's table to include the needed column
precalculated and filled. But it means to couple the dataset to the grid
needs and I'd prefer to mantain the DataSet independent of the presentation
layer.
How can I do that?

Any hint is welcomed
Thanks in advance
Sammy

With templated columns you can bind data using an expression that does
the computation. For example:

<asp:Label ID="IncPriceLabel" runat="server" Text = '<%#
(double)Eval("price") * 1.175 %>' />

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top