Hey,
I have a situation where i have data like following
User1 Address1 HomeAddress Address1Value
User1 Address2 WorkAddress Address2Value
User1 Phone1 HomePhone Phone1Value
User1 Phone2 WorkPhone Phone2Value
User2 Address1 HomeAddress Address1Value
User2 Address2 WorkAddress Address2Value
User2 Phone1 HomePhone Phone1Value
User2 Phone2 WorkPhone Phone2Value
User3 Address1 HomeAddress Address1Value
User3 Address2 WorkAddress Address2Value
User3 Phone1 HomePhone Phone1Value
User3 Phone2 WorkPhone Phone2Value
Now i have to display the above data as following in a gridview.
**Users HomeAddress WorkAddress HomePhone WorkPhone**
User1 Address1Value Address2Value Phone1Value Phone2Value
User2 Address1Value Address2Value Phone1Value Phone2Value
User3 Address1Value Address2Value Phone1Value Phone2Value
One option i have is that i loops through the dataset and convert 4 rows of data into columns. and then bind the data. but that does not look like an efficient way to do since i have plenty of data.
Is there any efficient way to do this?
I am using LINQ to SQL for this. I have a Sql Server view that returns the result of 4 rows per user.