there is code had been provided by for display checked items of gridview as a HTML outside gridview
i have modified it a little now the checked item displays as a HTML Link .. i have added a span tag with sign 'X' and i want on click of that sign the corresponding row get remove .. i try to solve it but on click on 'x' All item get removed, instead of single row
<script type = "text/javascript">
$("[id*=CheckBox1]").live("click", function() {
$("#selected").empty();
$("[id*=GridView1] [id*=CheckBox1]").each(function() {
if ($(this).is(":checked")) {
var link = $("td", $(this).closest("tr")).eq(1).html();
$("#selected").append("<a id='xy' href='" + link + "' >" + link + " </a>" +
"<span class='remov'>x</span>" + "<br/>");
}
});
});
</script>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns = "false">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Name" HeaderText="Name" />
</Columns>
</asp:GridView>
<br />Selected Rows
<div id = "selected">
</div>
Output is like this :
Selected Rows
John x
Sam x
Mike x
Jerry x
Thomas x
i want on click 'x' , the corresponding name get remove.