473,387 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Datagrid Columns

I would like to know how to:
1.Create a datagrid column that is not mapped to a table
column but whose value is dependent on other columns, say
a TotalValue col whiich is equal to Qty*Price.
2.Validate datagrid rows
3.Change some column values before they are updated, say
to append a ProductCode column with a prefix "NY".
Nov 22 '05 #1
3 1341
The first one, what you can do is create an expression column in the
underlying datatable called in this instance TotalValue which is Qty*Price.
By doing this, if QTY or Price are changed, the Total will be reflected
immediately
http://www.ondotnet.com/pub/a/dotnet...pressions.html

You can use any of the methods of the grid like CurrentCellChanged or
Navigate. However, if you use a Strongly typed Dataset, validation will
occur without intervention since it won't allow data that doesn't comply to
the rules in it.

YOu can loop through your datatable using foreach or whatever loop you want.
Test that a column meets a certain condition and change the value of the
table value Row/Column by appending whatever you want on it.

HTH,

Bill
"Francis Muraya" <fm*****@yahoo.com> wrote in message
news:00****************************@phx.gbl...
I would like to know how to:
1.Create a datagrid column that is not mapped to a table
column but whose value is dependent on other columns, say
a TotalValue col whiich is equal to Qty*Price.
2.Validate datagrid rows
3.Change some column values before they are updated, say
to append a ProductCode column with a prefix "NY".

Nov 22 '05 #2
Hi,

1) Add a calculated column
Private Sub AddPrice()

Dim dc As DataColumn

dc = New DataColumn("Price")

dc.DataType = System.Type.GetType("System.Decimal")

dc.Expression = "Quantity * Each"

dsInvoicesData.Tables(0).Columns.Add(dc)

dc = Nothing

End Sub

2) http://www.syncfusion.com/FAQ/WinFor...c44c.asp#q773q

3) http://support.microsoft.com/default...;en-us;Q318581

Ken

------------------

"Francis Muraya" <fm*****@yahoo.com> wrote in message
news:00****************************@phx.gbl...
I would like to know how to:
1.Create a datagrid column that is not mapped to a table
column but whose value is dependent on other columns, say
a TotalValue col whiich is equal to Qty*Price.
2.Validate datagrid rows
3.Change some column values before they are updated, say
to append a ProductCode column with a prefix "NY".

Nov 22 '05 #3
Hi

I created a datagrid that allows you to add calculated values, based on an
eveluation string. Maybe it's intresting to check it out:

http://www.microsoft.com/belux/nl/ms.../datagrid.mspx

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Francis Muraya" <fm*****@yahoo.com> schreef in bericht
news:00****************************@phx.gbl...
I would like to know how to:
1.Create a datagrid column that is not mapped to a table
column but whose value is dependent on other columns, say
a TotalValue col whiich is equal to Qty*Price.
2.Validate datagrid rows
3.Change some column values before they are updated, say
to append a ProductCode column with a prefix "NY".

Nov 22 '05 #4

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

Similar topics

1
by: Amber | last post by:
The DataGrid allows you to make columns visible or invisible on demand - even edit and other special columns. This article will show you how it is done. Some developers have reported problems...
1
by: Amber | last post by:
The DataGrid allows you to make columns visible or invisible on demand - even edit and other special columns. This article will show you how it is done. Some developers have reported problems...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
4
by: tshad | last post by:
I am having trouble with links in my DataGrid. I have Links all over my page set to smaller and they are consistant all over the page in both Mozilla and IE, except for the DataGrid. Here is a...
2
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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
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...

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.