Note that there are some explanatory texts on larger screens.

plurals
  1. POPartialViews in Asp.net MVC 3 RC2
    primarykey
    data
    text
    <p>I'm messing around w/ MVC 3 a little and am having trouble getting a partial view to show up properly.</p> <p>Here's my dilemma:</p> <p>In my Home/Index view I have an actionLink to my controller/action, Post/Create:</p> <pre><code>&lt;p&gt; @Html.ActionLink("Create Post", "Create", "Post") &lt;/p&gt; &lt;div id="PostCreation"&gt; &lt;/div&gt; </code></pre> <p>My Create View is a partialView with a basic form for title, content, etc.:</p> <pre><code>@using (Html.BeginForm()) { &lt;div&gt; &lt;fieldset&gt; &lt;legend&gt;Post Creation&lt;/legend&gt; &lt;div class="editor-label"&gt; @Html.LabelFor(m =&gt; m.PostTitle) &lt;/div&gt; &lt;div class="editor-field"&gt; @Html.TextAreaFor(m =&gt; m.PostTitle) &lt;/div&gt; &lt;p&gt; &lt;input type="submit" value="Publish" /&gt; &lt;/p&gt; &lt;/fieldset&gt; &lt;/div&gt; } </code></pre> <p>I added some jQuery to my _Layout.cshtml file to capture clicks on attributes:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $('a').live('click', function () { $.get($(this).attr('href'), function (html) { $('#PostCreation').html(html); }); }); }); &lt;/script&gt; </code></pre> <p>The click should then update the PostCreation div which is in the Home/Index view.</p> <p>Using firebug I found that as I step through the jQuery the ParialView does get rendered properly in the Home/Index but then once I finish the jQuery function it renders an entire new page that just displays the Post/Create form.</p> <p>Any help is appreciated. Thanks.</p>
    singulars
    1. This table or related slice is empty.
    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. 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