My model looks like:
class Store
{
...
virtual ICollection<StoreItem> items;
...
}
The View for the Store Shows Store properties and a table with items and StoreItem properties. I want that when an Item is clicked, and a jQuery UI dialog is displayed to edit the Item model. For this, I created Views actions for StoreItem, and embedded a partial frame in the Dialog.
Something like:
<div id="modaldlg" title="Edit item?">
@using (Ajax.BeginForm(
new AjaxOptions
{
HttpMethod = "get",
InsertionMode = InsertionMode.Replace,
}))
{
@Html.Action("Edit", "StoreItem")
}
</div>
My problems:
- The StoreItem controller action is triggered when the parent page loads. I want it to trigger when the dialog is displayed, because it depends on the item that was clicked.
- When I close the jQuery Dialog, I want to trigger a post -> the StoreItem's controller action. How do I do this?