Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to make sure your views are typed to the right model. Your view currently is typed to the <code>PasswordModel</code> model, which appears to be one section of your page. If you create a model composed of models for each section, it will make this easier:</p> <pre><code>class ProfileModel { PasswordModel Password { get; set; } BiographyModel Biography { get; set; } ... } </code></pre> <p>You would then set your Profile view to be typed to <code>ProfileModel</code>. Then you can pass each model to the partials:</p> <pre><code>@Html.Partial("_BiographyPartial",Model.Biography) </code></pre> <p>And an example _BiographyPartial would look like:</p> <pre><code>@model Projects.Models.BiographyModel ... &lt;h1&gt;@Model.SomeBiographyProperty&lt;/h2&gt; </code></pre> <p>You should be careful to check that your validation, assuming you have some, is working correctly with this set up. </p> <p>Alternatively, you could put all of your data into one flat model and pass the whole model to each partial view.</p> <p><strong>EDIT</strong>: Partial views aren't backed by controllers and actions, they're simply views that are rendered using the data you pass to them from the calling view. What you're trying to do right now is render the <code>_UsernamePartial</code> action. If you want to do that you can try using <code>Action</code> instead of <code>Partial</code>:</p> <pre><code>&lt;div id="left"&gt; @Html.Action("_UserNamePartial") ... &lt;/div&gt; </code></pre> <p>And render that action as a partial view:</p> <pre><code>public ActionResult _UsernamePartial() { var usernameModel = new UsernameModel(); using (var db = new DataContext()) { usernameModel.Nickname = (from u in db.Users where u.ID == WebSecurity.CurrentUserId select u.Username).FirstOrDefault(); } return PartialView(usernameModel); } </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.
    1. This table or related slice is empty.
    1. VO
      singulars
      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