Click here to Skip to main content
16,004,833 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i know the selecting all checkbox and clear all checkbox but i need a code to delete selected checkboxes in datagrid imn .net(if their are 5 checkboxes i have delete 3 selected checkboxes in datagrid)
Posted

1 solution

WAY 1:
What you need to do is, once you select the checkboxes of the rows that you want to delete, trigger a postback event like via Delete button on the page.

In code-behind, loop through the grid rows and get the row whose checkboxes are checked. Modify the datatable/datasource accordingly.
Commit the changes made to datatable/dataset.
Use this new datatable/dataset as a datasource of your grid. Rebind the grid with this one.

WAY 2:
On click of checkboxes, maintain the unique keys of each row client side in a hidden field. on postback, get all row unique keys from this hidden field and remove those rows from the dataset. Rebind the datagrid with this dataset.
 
Share this answer
 

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