How to delete from the drop-down list whether an item is deleted from the grid view

advertisements

I have a button, dropdownlist, Gridview on the page. On Page load I bind the gridview and dropdownlist from the same table.In girdview I have checkboxs and if I checked the checkboxs and click on button then it delete the selected rows. My problem is how I can remove the dropdownlist items which I have removed from the GridView.

Just like this I have one employee table. In dropdown list I bind empid to dropdownlist and bind all the field in gridview.

Dropdowlist

emp001
emp002
emp003

Gridvivew columns

empid | empname | contact | des
emp001|   X     | 999     | XY
emp002|   y     | 888     | OB
emp003|   Z     | 987     | UU

On button click if I delete 'emp001' from gridview then I need emp001 to be deleted from the dropdownlist as well. Can anyone help with the code?


You need to rebind both Grid and Dropdownlist again on Button_Click.