Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Computed columns in datagrid

Reply
Thread Tools

Computed columns in datagrid

 
 
Raymond Du
Guest
Posts: n/a
 
      12-01-2004
Hi,

Can I have computed columns in a datagrid? If yes, how?

TIA


 
Reply With Quote
 
 
 
 
mortb
Guest
Posts: n/a
 
      12-01-2004
one way:

add a column
insert values in it in the event ItemDatabound

example column three is your computed value column:

private void _Grid_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)

{

if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)

{

e.Item.Cells[3].Text = "your computed value";

}

}

cheers,
mortb

"Raymond Du" <> wrote in message
news:uL$...
> Hi,
>
> Can I have computed columns in a datagrid? If yes, how?
>
> TIA
>
>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?VGFtcGEgLk5FVCBLb2Rlcg==?=
Guest
Posts: n/a
 
      12-01-2004
The data table have a compute() method that you can do this. Check this
article out
http://aspnet.4guysfromrolla.com/articles/082003-1.aspx

"Raymond Du" wrote:

> Hi,
>
> Can I have computed columns in a datagrid? If yes, how?
>
> TIA
>
>
>

 
Reply With Quote
 
Joe Fallon
Guest
Posts: n/a
 
      12-02-2004
A 3rd idea would be to do the computation in your data source.
e.g if it is a custom collection then add a readonly property to the
contained child class and have it return the computation. Then you can treat
it as a bound column in the grid.
--
Joe Fallon


"Raymond Du" <> wrote in message
news:uL$...
> Hi,
>
> Can I have computed columns in a datagrid? If yes, how?
>
> TIA
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Computed field in temp table causes error in .NET John Dalberg ASP .Net 1 02-03-2006 12:14 AM
How is Object.hashCode() computed? Aryeh.Friedman@gmail.com Java 2 05-24-2005 02:16 AM
Content-type: multipart/form-data - how is boundary computed Pascal Steiss HTML 1 03-19-2005 10:00 AM
Binded Datagrid Formatting columns or hiding columns ton ASP .Net Web Controls 2 02-11-2004 04:09 AM
Columns and Inherited Datagrid...Active Schema does not support columns rob thomson ASP .Net Datagrid Control 0 09-04-2003 03:09 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57