开发者

How to bind gridview through linq

开发者 https://www.devze.com 2022-12-30 07:35 出处:网络
I am using Linq-to-SQL. Currently I am binding gridview through linq which query written in business logic call. I ha开发者_JAVA技巧ve extract record through query in business logic class and I want

I am using Linq-to-SQL.

Currently I am binding gridview through linq which query written in business logic call. I ha开发者_JAVA技巧ve extract record through query in business logic class and I want to bind that particular data to gridview and return data.

How to return data which type is array?

The code is here:

CMSBusiness.DataClasses1DataContext db = new DataClasses1DataContext();
var cate = 
      from p in db.categoryTables
      select new 
      {
           categoryId=p.categoryId,
           categoryName=p.categoryName,
           categoryDesc=p.categoryDesc
      };

How to return value and bind gridview?


Try

gridView.DataSource = cate;
, this should work.
We also recommend you to take a look at this article.

0

精彩评论

暂无评论...
验证码 换一张
取 消