views:

42

answers:

2

Hi,

if I have an ajax form with AjaxOptions like this :

(Ajax.BeginForm(new AjaxOptions { UpdateTargetId = "okContent", HttpMethod = "Post", LoadingElementId = "ajaxLoader" })

is it possible to change UpdateTargetId in controller(after pressing submit button)?

Thank You.

+1  A: 

No. The target id is not sent. It is only used in the javascript callback to determine which element to update with the returned HTML content. If you need more control over what happens on return, I suggest using the jQuery library's AJAX methods instead.

tvanfosson
+1  A: 

No, you can't do that. And if you could that would have been a violation of the mvc pattern. The controller shouldn't know about your html structure.

Mattias Jakobsson