473,513 Members | 2,777 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom field in a datagrid?

Is there way I can have a datagrid that is bound to a dataset display a
result from a function rather than from a field in the dataset?

As an example, I have a table that has a first name and last name field,
I would like to just display the full name there... Also, I have other
need to, such as taking a quantity and multiplying it by a price and
putting it in an extension field.

Aaron

--
---
Aaron Smith
Remove -1- to E-Mail me. Spam Sucks.
Nov 21 '05 #1
3 1071
Aaron Smith wrote:
Is there way I can have a datagrid that is bound to a dataset display a
result from a function rather than from a field in the dataset?

As an example, I have a table that has a first name and last name field,
I would like to just display the full name there... Also, I have other
need to, such as taking a quantity and multiplying it by a price and
putting it in an extension field.

Aaron


Take a look at the DataColumn.Expression property.

Greg
Nov 21 '05 #2
Aaron,

Have a look at this

datatable expression

http://msdn.microsoft.com/library/de...ssiontopic.asp

You have to create an extra column for that where you can set in the
constructor this expression as well.

http://msdn.microsoft.com/library/de...sctortopic.asp

I hope this helps.

Cor

"Aaron Smith" <th**********@smithcentral.net>
Is there way I can have a datagrid that is bound to a dataset display a
result from a function rather than from a field in the dataset?

As an example, I have a table that has a first name and last name field, I
would like to just display the full name there... Also, I have other need
to, such as taking a quantity and multiplying it by a price and putting it
in an extension field.

Aaron

--
---
Aaron Smith
Remove -1- to E-Mail me. Spam Sucks.

Nov 21 '05 #3
Ok.. I'll read up on it. I'm trying it right now, but having some
difficulties. The fields are in a different table, so I may have to
change what I store in this table for it to work right..

Cor Ligthert wrote:
Aaron,

Have a look at this

datatable expression

http://msdn.microsoft.com/library/de...ssiontopic.asp

You have to create an extra column for that where you can set in the
constructor this expression as well.

http://msdn.microsoft.com/library/de...sctortopic.asp

I hope this helps.

Cor

"Aaron Smith" <th**********@smithcentral.net>
Is there way I can have a datagrid that is bound to a dataset display a
result from a function rather than from a field in the dataset?

As an example, I have a table that has a first name and last name field, I
would like to just display the full name there... Also, I have other need
to, such as taking a quantity and multiplying it by a price and putting it
in an extension field.

Aaron

--
---
Aaron Smith
Remove -1- to E-Mail me. Spam Sucks.


--
---
Aaron Smith
Remove -1- to E-Mail me. Spam Sucks.
Nov 21 '05 #4

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

Similar topics

0
1327
by: Craig | last post by:
Does anyone know whether you can take a dataset and serialise into a custom collection? Over the past couple of months I've been retreiving my datasets and manually iterating them to create my...
1
2215
by: Conawapa11 | last post by:
I'm having trouble figuring this problem out and every example out there deals with simple objects within a custom collection. Take this example: public class ComplexClass { private int id;...
6
1467
by: Ben | last post by:
Hi I've got a problem with a custon control that inherits form the UserControl class and that used the overlib javascript library. The control works well in a standard form but when I used it in...
2
1193
by: Dave | last post by:
Hello. I have a boolean field in my database (true=1, false=0), nowwhen I bind data to my DataGrid it shows me "1" or "0", but I want while displayng this data show some ohter text, for example if...
6
1851
by: Whoever | last post by:
Here's what I have A custom collection: public class aUser { public string UserName { get {...} set {...} } public class UserList : System.Collection.CollectionBase { public void Add(aUser...
3
3521
by: The Developer | last post by:
Hi All, I have a web application where I am adding a custom attribute to my ASP.NET text box control and changing value of that attribute at client side using JavaScript. My problem is that...
7
3326
by: Girish | last post by:
OK.. phew. Playing with data grids for the past few days has been fun and a huge learning experience.. My problem. I have a requirement to display a gird with a gird. Within the embedded grid,...
1
1222
by: Ben Pursley | last post by:
I would like to add a column to a datagrid and populate that new cell with a custom formula like: Minutes Custom Field --------- ------------- 240 4:00...
2
11695
by: DraguVaso | last post by:
Hi, I'm looking for a nice way to format the cell of my datagrid according to some predefined 'rules'. I found a lot on the site of George shepherd, but it wasn't really what I was looking for:...
1
3578
by: nate axtell | last post by:
In VB .Net I made a custom CheckBox column style (for the Datagrid control) that maps to two DataTable columns , one it uses for the Checked status and the other it uses for the Enabled status. I am...
0
7254
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7373
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,...
0
7432
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...
0
5677
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,...
1
5079
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...
0
4743
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...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
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...

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.