473,763 Members | 6,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Computed columns in datagrid

Hi,

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

TIA
Nov 18 '05 #1
3 1978
one way:

add a column
insert values in it in the event ItemDatabound

example column three is your computed value column:

private void _Grid_ItemDataB ound(object sender,
System.Web.UI.W ebControls.Data GridItemEventAr gs e)

{

if(e.Item.ItemT ype == ListItemType.It em || e.Item.ItemType ==
ListItemType.Al ternatingItem)

{

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

}

}

cheers,
mortb

"Raymond Du" <rd**@yahoo.com > wrote in message
news:uL******** ******@TK2MSFTN GP15.phx.gbl...
Hi,

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

TIA

Nov 18 '05 #2
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

Nov 18 '05 #3
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" <rd**@yahoo.com > wrote in message
news:uL******** ******@TK2MSFTN GP15.phx.gbl...
Hi,

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

TIA

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7238
by: Paulo Andre Ortega Ribeiro | last post by:
I have a table with fields called fname (First Name) and lname (Last Name). I need the user´s email thai is compose from lname and fname: LOWER(LEFT (fname,1) + lname) Is there any difference between creatig this computed column ia a table or in a view in SQL Server 2000? I can do: 1. CREATE TABLE Users(
2
11324
by: tperovic | last post by:
Using SS2K, I'm getting the following error while bulk inserting: Column 'warranty_expiration_date' cannot be modified because it is a computed column. Here is my bulk insert statement: BULK INSERT dbo.TestData FROM 'TestData.dat' WITH (CHECK_CONSTRAINTS,
1
1391
by: GJK | last post by:
In SQL Sever, do the size of computed columns gets added to the total size of the tables? Does SQL server stores the actual values in computed columns? Thanks _GJK
4
12640
by: Henning N?rg?rd | last post by:
I'm working as software developer mostely om SQL-server platform. On SQL-server we are using a lot of "Computed Columns" Does anyone know if that is possible to do in DB2 too ? I mean - define a column, based on SQL-query in database. And how - do i do - would like a practic example if possible. /Henning
5
2437
by: Jay Villa | last post by:
Is it possible to update only few columns in datagrid during OnUpdateCommand event ? If so, could you help me .... -thanks Jay
1
1931
by: Dave | last post by:
I am relativly new to visual basic, so this may be a no- brainer. I am attempting to use a computed column in a VB dataset defined as followe: ' 'dcCost ' Me.dcCost.ColumnName = "Cost"
0
1253
by: am72de | last post by:
Hi all, I have two identical DataTables. One of the columns is a computed one. With a DataReader I try to copy the DataRows from one table to the other, but I get an InvalidOperationException, because calculated columns can not be set. Does anyone know a solution to work around this behaviour, for example how to exlude this column from the copy process (without removing it from the table)? Thanks in advance
7
5793
by: Aamir Mahmood | last post by:
Hi All I have DataTable object. Is there a way that I can know which fields (columns) in the table are computed. Apparantly the DataTable.Columns returns all columns both computed and other. Any help would be appreciated.
0
1306
by: perdijc | last post by:
1. I created a dataset based on the table with computed columns with a wizard. 2. A create a form bound to dataset. 3. When I try to save, it shows a message: The column LoadDate cannot modify because it is either a computed column or is the result of UNION operator. It is right, the column LoadDate is computed column and it can not modified. Question. How can I save the regulars columns in a dataset based on the table with computed...
0
9387
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10148
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10002
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2794
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.