September 30th 2008

Make Sure Item is Selected For Deletion in ListView Prior to Post Back using jQuery

I have been adding the ability to delete multiple items in a ListView for a while now. One thing that has been bugging me though was the user could click the button to delete the selected items even if no items were selected which would popup a delete confirmation. If the user clicked yes, then a post back would occur and be confusing.

Live Demo | Download (HTML, CSS, JavaScript)

End Product:

Before Image


Whenever a checkbox is checked or un-checked the function checkButtonStatus() is run. The function is also run on document ready. The function takes care of checking whether the button should be enabled or not.

Be sure to check out the Demo and the Download