views:

680

answers:

3
A: 

Use an Update Panel. It will capture the post back from your delete link and asyncronously reload the content.

Take a look at http://www.asp.net/ajax/documentation/live/Tutorials/CreatingPageUpdatePanel.aspx for an example.

Hope that helps.

Gavin

Gavin
I am using mvc asp.net application in vs2008 will update panel work in it
Mostly, no. The Microsoft AJAX ASP controls use ViewState, and are thus incompatible with MVC. It's possible to make it work with the "client-only" version of the library, but now that jQuery is officially supported, it turns out to be a much better solution for AJAX coding.
Craig Stuntz
A: 

First, make sure that your delete link posts a form. Your question is not clear about this, but since you say that you are using a delete link I am guessing that you are doing this with a GET. Actions that modify resources should be done via POST, not GET.

Once you've done that, you can use the jQuery AJAX form plug-in to do the post via AJAX. It's quite simple, and once you have a working form to do that delete, you will find converting its to use the AJAX plug-in to submit the form instead very straightforward. Just follow the examples on the site.

Craig Stuntz
A: 

Use jQuery:

<script type="text/javascript">
    function deleteComment(id) {
        $.post(
            "/MyController/DeleteAction",
            { id : id }
            function (data) {
                // do some gui updates
            });
     }
</script>

And use in a link:

<a onclick="deleteComment(<%= CommentId %>); return false;" href="#">Delete</a>
veggerby