Q:

double click on mvc 4 web grid

I am preparing a mvc 4 application and I am pretty new to it. I would like to implement a functionality like by double clicking a row of mvc 4 webgrid I should call an action method in ajax. But unfortunately I could not find how to implement double click on mvc 4 web grid.
Can you please help me on that?

A:

You could use the .dblclick() event in jQuery. For example:
<script type="text/javascript">
    $(function() {
        $('table td').dblclick(function() {
            $.ajax({
                url: '@Url.Action("SomeAction", "SomeController")',
                type: 'POST',
                success: function(result) {
                    // do something with the result from your AJAX call
                }
            });
        });
    });
</script>

Obviously there are lots of improvements that could be done to this code. For example you could use HTML5 data-* attributes on your grid to specify the url to the controller action that needs to be invoked and then externalize this script in a separate javascript file. You might also need to adjust the jQuery selector to match your WebGrid element.

