shkipper
shkipper

Reputation: 1413

.ASP MVC, access AjaxOptions in controller

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.

Upvotes: 1

Views: 770

Answers (2)

Mattias Jakobsson
Mattias Jakobsson

Reputation: 8237

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.

Upvotes: 1

tvanfosson
tvanfosson

Reputation: 532465

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.

Upvotes: 1

Related Questions