Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
i want to bind the LINQ query result to a gridview
i have created a class where i kept my logic of Linq Query using Entity frame work
example:
using(tesingmodel.testingentities TE =new tesingmodel.testingentities())
{
var query=from e in TE.emps
select e;
}

Query will return a result set
in my button logic i need to bind the query to gridview
how to do this plz suggest me a solution

Thanks Inadvance
Posted
Updated 16-Apr-12 7:30am
v5
Comments
[no name] 16-Apr-12 13:31pm    
Format code snippets when posting like everyone else here does.

below is the method ::::

public static list<emp> fillgrid()<br />
{<br />
  testingentities TS=new testingentities(); <br />
var query=from e in TE.emps<br />
 select e;<br />
return query.ToList();<br />
}
 
Share this answer
 
v2
The solution is to learn the tools you are working with. Here is a hint. GridView.DataSource takes an IEnumerable object. Now you can figure out how to get such an object from the LINQ query.
 
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