开发者

How to bind gridview through linq

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜