Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Tue, 22 Jul 2008 10:09:21 -0500,    group: microsoft.public.dotnet.framework.aspnet.datagridcontrol        back       


How to add calculated columns to a GridView?   
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
date: Tue, 22 Jul 2008 10:09:21 -0500   author:   SammyBar

Re: How to add calculated columns to a GridView?   
Why don't you make a template column and fill it in the RowDataBound event?

-- 
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"SammyBar"  wrote in message 
news:uEeRrzA7IHA.616@TK2MSFTNGP02.phx.gbl...
> 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
>
>
date: Wed, 23 Jul 2008 16:23:41 +0300   author:   Eliyahu Goldin

Re: How to add calculated columns to a GridView?   
On 22 Jul, 16:09, "SammyBar"  wrote:
> 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
date: Thu, 24 Jul 2008 19:35:49 -0700 (PDT)   author:   Stan

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us