Custom field in a datagrid?

  • Thread starter Thread starter Aaron Smith
  • Start date Start date
A

Aaron Smith

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 said:
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
 
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 said:
Aaron,

Have a look at this

datatable expression

http://msdn.microsoft.com/library/d...fsystemdatadatacolumnclassexpressiontopic.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/d...l/frlrfsystemdatadatacolumnclassctortopic.asp

I hope this helps.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top