Use different updatetargetid based on view

Posted by Jerrie Pelser on Stack Overflow See other posts from Stack Overflow or by Jerrie Pelser
Published on 2009-05-29T10:46:52Z Indexed on 2010/03/17 17:01 UTC
Read the original article Hit count: 253

Filed under:

I have a web page which display a list of items in a HTML table. Above the list is a form which allows the user to add a new item to the list via AJAX (using Ajax.BeginForm). When the data is posted to the controller via AJAX I add the new item to the database backend and generate a new table row via a Partial View which then gets appended to the exisiting table.

When the form to add new items however contains errors, I want to render the form back to the web browser and display that.

So here is the question: Is it possible to specify the UpdateTargetId from within the controller? At the moment whatever View I return from the controller gets inserted in the same target, but I would like to update a different target (ie. different UpdateTargetId) based on whatever view was returned from the controller.

Any help would be appreciated...

© Stack Overflow or respective owner

Related posts about asp.net-mvc