如何将复选框选择的gridview行传递到另一个gridview [英] how to pass the checkbox selected gridview rows into another gridview
本文介绍了如何将复选框选择的gridview行传递到另一个gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi
将选中的gridview行的复选框传递到另一个页面中,并显示在gridview中
hi
pass the checkbox selected gridview rows into another page and display in a gridview
<table>
<tr>
<td>
<table>
<tr>
<td>
<table>
<tr>
<td>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="3"
GridLines="None" BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px"
CellSpacing="1" onselectedindexchanged="GridView1_SelectedIndexChanged"
AutoGenerateSelectButton="True" >
<Columns>
<asp:TemplateField>
<ItemTemplate>
<input type ="checkbox" value="" onclick='addthis(this,<%#Eval("EmpSalary") %>)' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<%# Eval("EmpName") %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Emp Salary">
<ItemTemplate>
<%# Eval("EmpSalary") %>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
<RowStyle BackColor="#DEDFDE" ForeColor="Black" />
<SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
</asp:GridView>
<input type="text" id="resdiv" value="0" />
<asp:HiddenField ID="hidden1" runat="server" />
<asp:Button ID="bbbtbn" runat="server" Width="50px" onclick="bbbtbn_Click" />
<asp:TextBox ID="txt" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
推荐答案
1.在第一个gridview中的checkbox_checked事件上,获取当前选中的行并将其添加到数据表中.
2.在同一事件中,编写数据绑定逻辑以将第二个网格绑定到在步骤1中创建的数据表.就这样,您就完成了.
1. On the checkbox_checked event in the first gridview, get the current checked row and add it to a datatable
2. In the same event write the databind logic to bind the second grid to the datatable created in step 1. Thats all, you are done.
这篇关于如何将复选框选择的gridview行传递到另一个gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文