views:

1219

answers:

3

Can anyone tell me how can I submit values to Controller using ActionLink and POST method?
I don't want to use buttons.
I guess it has something with jquery.
Thank you!

A: 

In order to POST you need to submit form data. I don't think it's possible to do it with an ActionLink. Check out this link.

dnoxs
A: 

http://docs.jquery.com/Ajax/jQuery.post will work if you have custom data. If you want to post existing form, it's easier to use ajaxSubmit from http://jquery.malsup.com/form/#api.

And you don't have to setup this code in the ActionLink itself, since you can attach link handler in the document.ready event (which is a preferred method anyway), for example using $(function(){ ... }) jQuery trick.

queen3
+1  A: 

You can't use an ActionLink because that just renders an anchor tag.
You can use a JQuery AJAX post, see http://docs.jquery.com/Ajax/jQuery.post
or just call the form's submit method with or without JQuery (which would be non-AJAX), perhaps in the onclick event of whatever control takes your fancy.

AUSteve