Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I will appreciate it if you help me with some problems I encountered with my code.

I am working with the Entity Framework model. With the help of LINQ, I am trying to load entities and their associated data in a single query (i.e. to implement eager loading).

Here's the code-behind:

C#
protected void btn5_Click(object sender, EventArgs e)        
{         
   using (EStoreEntities ctx5 = new EStoreEntities())         
   { 
     var query =(from o in ctx5.Order_Details.Include("Order") select o);       
                                       //Order-navigation property
      tb5.Text = (queryas ObjectQuery).ToTraceString();           
      gv5.DataSource = query;          
      gv5.DataBind();         
   }     
}

I'm using the following ASP code:
ASP.NET
<asp:Button ID="btn5" runat="server" Text="Button" onclick="btn5_Click" />     <asp:GridView ID="gv5" runat="server"></asp:GridView>     
<asp:TextBox ID="tb5" runat="server" TextMode="MultiLine"></asp:TextBox>


How do I fix my code to make the Order table content display in my GridView control?
Thank you in advance.
Posted

1 solution

Hi check this it will help you..

http://developers.de/blogs/damir_dobric/archive/2008/06/14/linq-orderby-and-dynamic-query-sample.aspx[^]

check this for your reference

hope it helps

thanks..

don't for get to vote:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900