I have a Projects entity. The list of Projects is displayed in a Scaffolded List View as shown below. The Edit-Details-Delete are ActionLinks produced by the template.Each is linked to a new controller action and loads another View
ProjectName | Created By | Created On | Status |
-------------|------------|------------|--------|--------------------
Test Project | USER1 | 12/31/2010 | NEW | Edit |Details |Delete
Each Project has a status- New,Approved,Denied.
I want to add links to the list called Approve and Denied which do not load a view. They just change the status of the project. I believe these will be HTTP Post Links. I have googled and not found a good working example of this.
ProjectName | Created By | Created On | Status |
-------------|------------|------------|--------|------------------------------------
Test Project | USER1 | 12/31/2010 | NEW | Edit |Details |Delete|Approve|Denied
You could use AJAX:
and you will of course have a corresponding controller action that will take care of approving a project:
You could also use the
OnSuccessandOnFailureproperties of theAjaxOptionsto define respective javascript functions that will be called in case of those events.Needles to say that for the
Ajax.*helpers to do anything useful you need to include thejquery.unobtrusive-ajax.jsscript to your page:and must have enabled unobtrusive AJAX in your web.config: