.net - Linq to SQL object child properties in GridView -


For example, in my WCF, if I have a customer table and an order table that relates to each other on the customer, then

ID.

I have to calculate the number of orders for each customer.

In the regular VB code I can do this simply:

  Integer = 1234 as the new CUSTID ID = 1234 new customer as new MyService.Customer () cust = cust The above code works fine as in .getCustomer (CUSTID) Response.Write (cust.Orders.Count)  

but if I want to access from within a GridView It seems that the response is not the same (by a different method, but I am applying the same presentations in each method)

   & Lt; Asp: GridView ... & gt; ... & lt; Columns & gt; & Lt; ASP: Boundfield dated field = "Order number" header text = "order number" /> & Lt; / Column & gt; ... & lt; / Asp: GridView & gt;  

How can I do something like this?

You can try adding a partial method to the customer class named the ordercount and in the context that your boundfield Right-click on the DBML file and then go to View Code.

VB

  Return me an integer such as a partial public class customer loc Readline Property Order number. Order And anti and class  

C #

  public partial class customer {public int order law} {come here. }}}  

Comments