Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to render strongly typed partial views in one view ?
    primarykey
    data
    text
    <p>I am new to this asp net mvc but got a strong background in web forms. </p> <p>I would like to achieve a page that has a left hand menu of assets, that when you click on one of the assets then the details of that asset are available to edit on the right have side of the same page. </p> <p>Now I am thinking I will need to use 2 strongly types partial views. 1 for the left hand menu that is of type List of Asset and 1 for the right hand panel of type Asset. </p> <p>I have the left hand menu work so far </p> <p>Controller</p> <pre><code>public class AssetsController : Controller { // // GET: /Assets/ public ActionResult Index() { var assets =Repo.getAssetList(); return View(assets); } } </code></pre> <p>Layout View</p> <pre><code> @model IList&lt;CasWebSite.Models.Asset&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;title&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt; Assets&lt;/h1&gt; @RenderBody() &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Index View</p> <pre><code> @model IList&lt;CasWebSite.Models.Asset&gt; @{ Layout = "_Layout.cshtml"; } &lt;ul&gt; @foreach (var asset in Model) { &lt;li&gt;@asset.Name &lt;/li&gt; } &lt;/ul&gt; </code></pre> <p>So how do I add in the other view do I create a new partial view of type Asset, What would the controller look like would I still goto the page by going to the url /assets, and how do I pass values between the 2 partial views, as I need to know which asset was selected on the left hand side to edit? </p> <p>Thanks</p>
    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.
    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