Note that there are some explanatory texts on larger screens.

plurals
  1. POmvc partial view post
    primarykey
    data
    text
    <p>I have a company object which has a list of branch objects,</p> <p>my company view(residing in the company directory) has a strongly typed branch list view (residing in the branch directory)in it,</p> <p>each branch in the branch view has a delete button which I want to post to a delete action in the branch controller.</p> <p>at present the invoked delete action is the one in the company controller</p> <p>(there is a delete action in both company and branch)</p> <p>I believe I understand the reason it is doing what it is, however what is the best practice in this situation....</p> <ol> <li>should the branch list partial view reside in the company or branch directory?</li> <li>should the delete branch action reside in the company or the branch controller?</li> </ol> <p>I would think the branch list should be in the branch directory and call the branch controller, but how do I get it to do this when the partial view is loaded into the company details View?</p> <p>Hope that made sense,</p> <p>Thanks,</p> <p>Mark</p> <pre><code> &lt;% foreach (var item in Model) { %&gt; &lt;tr&gt; &lt;td&gt; &lt;form action="Edit" method="get"&gt; &lt;input type="submit" value="Edit" id="Submit1" /&gt; &lt;input type="hidden" name="id" value="&lt;%= item.Id %&gt;" /&gt; &lt;/form&gt; | &lt;form action="Branch" method="get"&gt; &lt;input type="submit" value="Details" id="Submit2" /&gt; &lt;input type="hidden" name="id" value="&lt;%= item.Id %&gt;" /&gt; &lt;/form&gt; | &lt;form action="BranchDelete" method="post"&gt; &lt;input type="submit" value="BranchDelete" id="Submit1" /&gt; &lt;input type="hidden" name="id" value="&lt;%= item.Id %&gt;" /&gt; &lt;/form&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload