选择gridvew中的行以在报表查看器中显示? [英] Choose rows in gridvew for showing in report viewer ?
问题描述
我在gridview中添加了一个列的复选框我想在gridvew中选择要在报表查看器中显示的行吗?
我尝试过:
DataGridViewCheckBoxColumn chk = new DataGridViewCheckBoxColumn();
dataGridView1.Columns.Add(chk);
chk.HeaderText =For Report;
chk.Name =chk;
i add a column in gridview for checkbox i want choose rows in gridvew for showing in report viewer ?
What I have tried:
DataGridViewCheckBoxColumn chk = new DataGridViewCheckBoxColumn();
dataGridView1.Columns.Add(chk);
chk.HeaderText = "For Report";
chk.Name = "chk";
推荐答案
你可以使用LINQ
查询数据,这是一个例子(不使用数据库):
You could useLINQ
to query the data, here is an example (without using a database):
BindingList<CandidatesForJob> CandidatesDetails = new BindingList<CandidatesForJob>();
// Execute Linq query over collection of CandidatesDetails
var q = from w in CandidatesDetails select w;
dataGridView1.DataSource = q.ToList();
请参阅: Linq to Data with DataGridView [ ^ ]
以下是使用数据库的示例:在DataView中查询DataRowView集合 [ ^ ]
这是一个 LINQ
教程: LINQ概述 [ ^ ]
See: Linq to object with DataGridView[^]
Here is an example using a database: Querying the DataRowView Collection in a DataView[^]
Here is a LINQ
tutorial: LINQ Overview[^]
这篇关于选择gridvew中的行以在报表查看器中显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!