By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,041 Members | 1,018 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,041 IT Pros & Developers. It's quick & easy.

Q: DataGrid Display

P: n/a

I have a question regarding displaying a foreign key in a DataGrid. To
explain my question, consider the following:

Suppose I have two tables A and B. Table A has the following structure:

UID_A ' Primary key of A
FK_B ' Foreign key to table B i.e. UID_B

and table B has the following structure:

UID_B ' Primary key of B
Name ' List of names e.g. John, Mark, William

If I set a DataSource of a DataGrid to be A, then I get a grid with values
such as:

2 7
3 8
4 15
5 7


What I would like to display is the following:

2 John
3 Robert
4 Bill
5 John

That is, I want to display the Name field instead of the FK_B value (these
are related as shown above).

Now, in the past, I have been able to do this by creating a new column in A,
iterating through all the rows and placing the B "Name" in the right place.

This works BUT I'm sure there must be a simpler, more elegant solution???

Thanks in advance


Mar 25 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.