I have a webpage and site using Linq. The page contains a gridview which shows customers and bound by a List (Of Customer).
I use the below code to get a single customer
Public Function GetCustById(ByVal id As Integer) As Customer Implements ICustomerService.GetCustById
Return DataContext.Customers.SingleOrDefault(Function(c) c.Id = id)
End Function
I then bind it to my gridview by passing all the customer IDs into the method. This displays all the rows as i need but i have one issue.
Some columns which are Foreign keys show up as 1,2 etc, Usually the way i have overcome this in the past ON DIFFERENT PROJECTS is by adding a sub query to my SQL query in the data layer but as you've guessed this is Linq so im not sure what is /not possible in order to get the Foreign Keys to display as values using Linq?
Im a little new to Linq so appreciate any help or articles that would help me with this.
Thanks