Solved

Datagrid's datakey field

Posted on 2003-11-19
3
1,366 Views
Last Modified: 2008-02-01
How does the datagrid's datakeyfield property support for composite keys? thanks in advance...
0
Comment
Question by:rxraza
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
ainapure earned 100 total points
ID: 9782949
I do not think datekeyfield property supports composite keys. I have used a lot of datagrids lately in one of my project, and the easiest way i worked around was to create a surrogate key in the database. So, for eg. say if your clientid and orderid makes up a unique row, i inserted a new column client_orderid which is an autoincremented.. and then i used this new column as a datakeyfield in datagrid.

-amit

0
 

Author Comment

by:rxraza
ID: 9788570
I would love to do that, but the thing is we do not want to change the database design just to accomodate the datakey feature of the grid. I would rather prefer to pass values through hidden fields or bound columns. Anyways, thanks for your help.
0
 
LVL 1

Expert Comment

by:ferguslogic
ID: 12915161
don't modify the DB design..instead concatenate the two fields in your select statement and put these combined fields into a single DataGrid column.
Then set your datakeyfield to this column.

That is the best solution as the datagrid does not support composite keys.  My understanding is that ASP.net 2.0 will have a successor control (GridView I believe) which will support this composite key functionality.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question