将Checked DetailsView行添加到新的DataTable [英] Add Checked DetailsView Rows to a new DataTable
本文介绍了将Checked DetailsView行添加到新的DataTable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在这里,我创建了一个包含joblist的grideview。下面我添加了一个datadetailview。当任何人选择gridview中的行时,它将在详细视图中显示...我在detailview中添加了一个列复选框。当有人选中复选框并单击应用下面的按钮,必须将详细视图中的数据添加到另一个应用的作业表中。我们可以这样做吗?
解决方案
On 应用按钮单击事件,做以下事情。
- 初始化一个新的
DataTable
- 循环遍历
DetailsView
Items / Rows 。循环内...
- 获取
CheckBox
按<$ c $控制c> FindControl 或其他东西- 通过已检查 .microsoft.com / zh-cn / library / system.web.ui.webcontrols.checkbox.checked(v = vs.110).aspx> CheckBox.Checked Property [ ^ ]
- 如果选中,请将
行
添加到循环前初始化的新DataTable
- 现在用新的
DataTable
Here I created a grideview containging joblist.below that i added one datadetailview .when anybody select the row in gridview it will shown in detail view...I added one column checkbox in the detailview.when anbody select the checkbox and click apply button below ,the data in the detailview must be added to another table applied jobs.how can we do that?
解决方案
On Apply Button Click Event, do the following things.
- Initialize a new
DataTable
- Loop through the
DetailsView
Items/Rows. Inside the loop...
- Get the
CheckBox
Control byFindControl
or something- Determine if it is
Checked
or not by CheckBox.Checked Property[^]- If that is checked add that
Row
to the newDataTable
initialized before the loop
- Now do anything you want to do with the new
DataTable
这篇关于将Checked DetailsView行添加到新的DataTable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文