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.
精彩评论