Hi Friends,
I want to show the data in gridview through the Linq data source, how can we do this ?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Ajay PatelPosted Jun 1, 2012, 2:54 AM
var countryList = (from country in objEntity.Countries
where country.flg_Deleted == false
orderby country.CountryName
select new
{
Country_ID = country.CountryID,
Country_Name = country.CountryName,
Country_Code = country.CountryCode,
Status = country.flg_Active.Value == true ? "Active" : "DeActive",
ISDCode = country.ISDCode
});
Grid.dataSource = countryList;
Grid.Databind();
Grid Column's Data Field Must be same as Column Name Here. Like Country_ID.Country_Name..
Satyapriya NayakPosted May 26, 2012, 1:14 AM
Please refer the below link
http://www.codeproject.com/Articles/33685/Simple-GridView-Binding-using-LINQ-to-SQL
Thanks