I need to capture the 'Update' click event with jQuery in an asp.net GridView and have no way of knowing where to start. I'm still rather new to jQuery. My GridView is attached to a SQLDataSource and, naturally, has all the bells and whistles that that combination affords. Any help would be greatly appreciated.
Jquery – How to capture ‘Update’ click event in ASP.NET GridView with jQuery
asp.netgridviewjquery
Related Topic
- Javascript – Get current URL with jQuery
- Javascript – Setting “checked” for a checkbox with jQuery
- Javascript – How to know which radio button is selected via jQuery
- Javascript – How to check whether a checkbox is checked in jQuery
- Jquery – How to select an element with multiple classes in jQuery
- Javascript – Convert form data to JavaScript object with jQuery
- Javascript – Disable/enable an input with jQuery
- Javascript – How to refresh a page with jQuery
Best Answer
Simply add the script block anywhere after the GridView is declared and it should work with the default non-templated GridView column. No code in the codebehind as it is purely a Javascript solution.
Use this if you are using a Link-type GridView column:
Use this if you are using a Button-type GridView column and you don't want your Javascript to block the postback:
Use this if you are using a Button-type GridView column and you want to have control whether to continue with the postback or not:
Update: I think this would be a better solution in replacement of the last (3rd) script block I presented above, since you won't need to update the __doPostBack function call manually based on the command name, and as such, it should be less error-prone:
Credit to Aristos for this idea. :)