Solved

Datagrid's datakey field

Posted on 2003-11-19
3
1,365 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
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Questions about INCLUDE FILES 2 43
Html split(text) 2 32
Session on Html 8 42
Making Table Thru ASP Response.write 5 21
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 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