HI all !
I've created an sipmle class LinqNorthwindDB (see code below) wich uses the Linq2SQl generated code from microsofts Northwind database.
On a asp.net page I connected a ObjectDataSource to this class with "List<Customer> GetCustomers()" as select method.
Connect this ObjectDataSource to a WebGrid works.
In WebGrid's designer mode, only the root band will be displayed, not it's child bands.
Why are those child bands with their columns not available ?
Any hint or idea is welcome. Thanks in advance !
Regards,
Claus
public class LinqNorthwindDB [
private DataContext dataContext; // the linq context from Northwind database
public LinqNorthwindDB() : this(WebConfigurationManager.ConnectionStrings["Northwind"].ConnectionString){}
public LinqNorthwindDB(string connectionString){
dataContext = new DataContext(connectionString);
DataLoadOptions loadOptions = new DataLoadOptions();
loadOptions.LoadWith<Customer>(customer => customer.Orders);
// Use these load options to retrieve only a subset of order records;
// loadOptions.AssociateWith<Customer>(customer => from order in customer.Orders where order.OrderDate > new
// DateTime(1998,1,1) select order);
dataContext.LoadOptions = loadOptions;
}
public List<Customer> GetCustomers(){
// The no-expression approach.
//return db.GetTable<Customer>().ToList<Customer>()
// The LINQ expression approach.
var matches = (from customer in dataContext.GetTable<Customer>()
select customer);
return matches.ToList<Customer>();
Claus,
For some reason, the images in your post are missing. Could you re-post them?
In the past, I've had trouble attaching two images to one post, so I suggest you post them in separate posts.