如何在数据表中选择特定行并将其绑定到gridview [英] How to select the particular row in a datatable and bind it to gridview

查看:81
本文介绍了如何在数据表中选择特定行并将其绑定到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


这篇关于如何在数据表中选择特定行并将其绑定到gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆