p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 1.0 and 1.1 Professional (http://p2p.wrox.com/forumdisplay.php?f=57)
-   -   How to add 2 columns in DataGrid.DataKeyField (http://p2p.wrox.com/showthread.php?t=6988)

drasko December 8th, 2003 04:42 AM

How to add 2 columns in DataGrid.DataKeyField
 
Hi all,

In my Web form I have DataGrid1 and want to
add 2 cols in DataGrid1.DataKeyField property.
If I had 1 col. it would be DataGrid1.DataKeyField = "ColName1",
but how can I add another more "ColName2"?

Nenad

glezmart January 16th, 2004 11:38 AM

hey, drasko

i saw that you wanna use two field for the key of the datagrid
use the property DataGrid1.DataKey and obtian DataKeyCollection and then you must use the methods of DataKeyCollection to add a collection of DataKey...



ManoYaka January 21st, 2004 06:25 AM

there are so many other options as well.

1. You can use a custom string in the select statement if you intend to navigate using your datakeys

2.in the datalist you can custom format the keys collection




kimroesch September 16th, 2004 02:44 PM

Can you give a vb code example of how DataKeyCollection is used. I cannot find any code to update a datagrid that has multiple key fields.

Thanks much,

kimroesch

planoie September 17th, 2004 09:05 AM

The datagrid only supports a single field.

Once you have a field in there, you can access the key value of a datagrid item.


All times are GMT -4. The time now is 09:36 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.