Click here to Skip to main content
14,983,344 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi

pass the checkbox selected gridview rows into another page and display in a gridview




XML
<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>
Posted
Comments
virang_21 15-Oct-11 21:41pm
   
Looking at the number of questions you posted looks like you need a lot of training before you can do your assignment/work. Take some online class or checkout www.asp.net and go through training mate !!!

1 solution

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.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900