如何在数据表中选择特定行并将其绑定到gridview
问题描述:
当我在第一个gridview中选中复选框时,在我的应用程序中使用2 gridview,我将根据选择填充第二个gridview.我的疑问是我要获取值并将其保存到数据表中.从该数据表中,我想选择特定的行,然后将其绑定到第二个gridview中.谁能帮我解决这个问题.
在此先感谢
Hi,
I am using the 2 gridview in my application when I selected the checkbox in the first gridview I will fill the 2nd gridview based on the selection. My doubt is I am fetching the values and saving it into the datatable. From that Datatable I want to select the particular rows and then I want to bind it in the 2nd gridview. can anyone help me to solve this problem.
Thanks in Advance
答
// you can select Data rows from datatable using select method
DataTable DT = new DataTable();
DataRow[] DR = DT.Select("Name = 'abc'");
// and copy array of datarows to datatable and bind grid with this table
DataTable dt2 = DR.CopyToDataTable();
标记为解决方案是对您的帮助
mark as solution is its help you