Linq可以根据GridView里某列的值查询相关的数据吗?
比如如下图的gridview:
请问如何用Linq查询出“本期销售”为5000的所有行呢。
------解决方案--------------------前台----
<asp:GridView ID="GridView2" runat="server">
</asp:GridView>
后台-----
using (TestEntities entity = new TestEntities())
{
var list = from testenties in entity.T_Theater select testenties;
//数据绑定
GridView2.DataSource = list;
//GridView 数据绑定
GridView2.DataKeyNames = new string[] { "ID" };
GridView2.DataBind();
}
------解决方案--------------------
这不可能吧。。。Are you sure?
from row in gridview.Rows.OfType<GridViewRow>()
where row.Cells[1].Text=="1" select row;