Customize the way DataList displays the number of rows of data
- 2020-05-30 19:51:00
- OfStack
PEAEWebSiteDataContext context = new PEAEWebSiteDataContext();
var p = from n in context.tb_News
where n.cname == " Campus information "
select n;
var pp = p.OrderByDescending(tb_News=>tb_News.issuedate).Take(1);var p1 = from n in context.tb_News
where n.cname == " arrangements "
select n;
var pp1 = p1.OrderByDescending(tb_News=>tb_News.issuedate).Take(1);
DataList1.DataSource = pp;
DataList2.DataSource = pp1;
DataList1.DataBind();
DataList2.DataBind();
The data source is dbml, usually with LinqDataSource, the number of bound rows cannot be limited.
Instead, select data in the background via Linq to Sql custom and bind it to Datalist.