Wednesday, August 22, 2012

Subcollection Binding in a DataGrid

Subcollection Binding in a DataGrid

I want to show a datagroid with a collection containing a sub collection. for example

Name  Address  Vacant

xx          xx             xx

            xxx

          xxxxx

             xx

 

I have 1 table containing Employee which contains 3 fields 1. Name, AddressID(Foreign Key), IsVacant

I have another table called Address which contains 4 Fields 1. AddressID(PK), Street1, Street2, City, State

Now in the DataGrid I have 3 Columns 1. Name 2. Address 3. IsVacant.  I am able to show Name and IsVacanat column in the DataGrid

I dont know how to show the Address column in the Datagrid

Any help would be useful. Please let me know if i can do this in any other way..

 

Answers & Comments...

Answer: 1

GaneshGdrBlr

Any help would be useful. Please let me know if i can do this in any other way..

I will give you two ways.

1. You can display the address in a single column seperated by comma Ex : Dravid,Newyork,US

2. Display the complete address in RowDetailsTemplate.

by :

Answer: 2

syed amjad

 I will give you two ways.

1. You can display the address in a single column seperated by comma Ex : Dravid,Newyork,US

2. Display the complete address in RowDetailsTemplate.

I dont want to use as a single column

But i am not sure how to use it with RowDetailsTemplate

Code sample would be more helpful

 

by :




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog