473,671 Members | 2,171 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 1077
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.Expr ession 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**********@s mithcentral.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**********@s mithcentral.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
1336
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 custom object based upon field 1, field 2 etc then adding that manally to my custom collection. This seems to be an Order N process, and it just _feels_ wrong. Anyone know of a Order 1 way to do this?
1
2223
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; private InnerClass anotherOne; public int ID
6
1474
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 a datagrid, the properties that were binded from the database doesn't keep their value through the page_load of the custom control. By using breakpoints on the properties methods of the control, I saw that they were all correctly binded and that the...
2
1202
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 field is 1 show "Active" and if 0 "Inactive"? How can I do this? Than You.
6
1855
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 user) {...} public aUser this {...}
3
3533
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 changed value of that custom attribute is not reflecting back at server side. Any ideas about this problem? Server side code: private void Page_Load(object sender, EventArgs e) { if (this.IsPostBack == false)
7
3339
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, theres a requirement to show a drop down menu list (this is a control I downloaded online) in one of the columns. For the purposes of this question, Ive implemented the drop down menu as a drop down list instead. Ive got all this working at this...
1
1226
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 am 1000 4:40 pm Any ideas?
2
11704
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: I found there: How can I change the font used in a Gridcell on a cell by cell or row by row basis. Wih this code I am able to change the Font/Background/... based on the position of the field (column and row). The problem is: it only changes...
1
3585
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 having a couple problems so far. 1. with the way the Paint method works: When I scroll to the right, the custom column gets Drawn on top of the left-most "Selecting" column (the one where the green arrows are displayed). How can I possibly modify...
0
8476
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8914
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
8820
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
8670
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6223
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
4224
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1809
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.