How to pass the checked row from one gridview to another
-
In my form, I have two gridviews. The left one is binded automatically on the click of a button and both the gridviews are having checkboxes. While selecting the checkbox on first row, that row should be added to the right gridview. when clicking on 2nd row checkbox, second should be added and likewise. This is possible on the click of a button. But I don't want a button click. How should I do this on the oncheckchange of the checkbox in gridview? I googled it for sometime, but didn't get much help. Can anybody have any idea please?
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
-
In my form, I have two gridviews. The left one is binded automatically on the click of a button and both the gridviews are having checkboxes. While selecting the checkbox on first row, that row should be added to the right gridview. when clicking on 2nd row checkbox, second should be added and likewise. This is possible on the click of a button. But I don't want a button click. How should I do this on the oncheckchange of the checkbox in gridview? I googled it for sometime, but didn't get much help. Can anybody have any idea please?
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
-
In my form, I have two gridviews. The left one is binded automatically on the click of a button and both the gridviews are having checkboxes. While selecting the checkbox on first row, that row should be added to the right gridview. when clicking on 2nd row checkbox, second should be added and likewise. This is possible on the click of a button. But I don't want a button click. How should I do this on the oncheckchange of the checkbox in gridview? I googled it for sometime, but didn't get much help. Can anybody have any idea please?
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
Add a ASP.NET checkbox in a Template column as below: asp:TemplateField <ItemTemplate> <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" oncheckedchanged="CheckBox1_CheckedChanged" /> </ItemTemplate> </asp:TemplateField> You can get the reference to the GridView row pertaining to the CheckBox clicked using the NamingContainer property protected void CheckBox1_CheckedChanged(object sender, EventArgs e) { CheckBox chk = sender as CheckBox; GridViewRow gvRow = chk.NamingContainer as GridViewRow; //You can get the cell values by gvRow.Cells[1].Text }