1

I've got a HTML file that I want to load using a partial view; however, when I type

@Html.P

the Partial function never shows up. Did partials get removed in ASP.NET 5 or has it been relocated to a different package? At the moment I'm using the following packages:

"Microsoft.AspNet.Mvc": "6.0.0-beta4",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta4",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta4",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta4",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta4",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta4"

Team.html

<!-- Team Section -->
<section id="team" class="bg-light-gray">
    <div class="container">
        <div class="row">
            <div class="col-lg-12 text-center">
                <h2 class="section-heading">Our Amazing Team</h2>
                <h3 class="section-subheading text-muted">Lorem ipsum dolor sit amet consectetur.</h3>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-4">
                <div class="team-member">
                    <img src="img/team/1.jpg" class="img-responsive img-circle" alt="">
                    <h4>Sayed Ibrahim Hashimi</h4>
                    <p class="text-muted">Co-Founder</p>
                    <ul class="list-inline social-buttons">
                        <li><a href="#"><i class="fa fa-twitter"></i></a></li>
                        <li><a href="#"><i class="fa fa-github"></i></a></li>
                    </ul>
                </div>
            </div>
            <div class="col-sm-4">
                <div class="team-member">
                    <img src="img/team/2.jpg" class="img-responsive img-circle" alt="">
                    <h4>Mads Kristensen</h4>
                    <p class="text-muted">Co-Founder</p>
                    <ul class="list-inline social-buttons">
                        <li><a href="#"><i class="fa fa-twitter"></i></a></li>
                        <li><a href="#"><i class="fa fa-github"></i></a></li>
                    </ul>
                </div>
            </div>
            <div class="col-sm-4">
                <div class="team-member">
                    <img src="img/team/3.jpg" class="img-responsive img-circle" alt="">
                    <h4>John Papa</h4>
                    <p class="text-muted">Contributor</p>
                    <ul class="list-inline social-buttons">
                        <li><a href="#"><i class="fa fa-twitter"></i></a></li>
                        <li><a href="#"><i class="fa fa-github"></i></a></li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-4">
                <div class="team-member">
                    <img src="img/team/1.jpg" class="img-responsive img-circle" alt="">
                    <h4>Brady Gaster</h4>
                    <p class="text-muted">Contributor</p>
                    <ul class="list-inline social-buttons">
                        <li><a href="#"><i class="fa fa-twitter"></i></a></li>
                        <li><a href="#"><i class="fa fa-github"></i></a></li>
                    </ul>
                </div>
            </div>
            <div class="col-sm-4">
                <div class="team-member">
                    <img src="img/team/2.jpg" class="img-responsive img-circle" alt="">
                    <h4>Mike Lorbetske</h4>
                    <p class="text-muted">Contributor</p>
                    <ul class="list-inline social-buttons">
                        <li><a href="#"><i class="fa fa-twitter"></i></a></li>
                        <li><a href="#"><i class="fa fa-github"></i></a></li>
                    </ul>
                </div>
            </div>
            <div class="col-sm-4">
                <div class="team-member">
                    <img src="img/team/3.jpg" class="img-responsive img-circle" alt="">
                    <h4>DanielTheCoder</h4>
                    <p class="text-muted">Contributor</p>
                    <ul class="list-inline social-buttons">
                        <li><a href="#"><i class="fa fa-twitter"></i></a></li>
                        <li><a href="#"><i class="fa fa-github"></i></a></li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-4">
                <div class="team-member">
                    <img src="img/team/1.jpg" class="img-responsive img-circle" alt="">
                    <h4>Naim Hammadi</h4>
                    <p class="text-muted">Contributor</p>
                    <ul class="list-inline social-buttons">
                        <li><a href="#"><i class="fa fa-twitter"></i></a></li>
                        <li><a href="#"><i class="fa fa-github"></i></a></li>
                    </ul>
                </div>
            </div>
            <div class="col-sm-4">
                <div class="team-member">
                    <img src="img/team/2.jpg" class="img-responsive img-circle" alt="">
                    <h4>Tyler Hughes</h4>
                    <p class="text-muted">Contributor</p>
                    <ul class="list-inline social-buttons">
                        <li><a href="#"><i class="fa fa-twitter"></i></a></li>
                        <li><a href="#"><i class="fa fa-github"></i></a></li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 text-center">
                <p class="large text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aut eaque, laboriosam veritatis, quos non quis ad perspiciatis, totam corporis ea, alias ut unde.</p>
            </div>
        </div>
    </div>
</section>
Pallas
  • 1,499
  • 5
  • 25
  • 57
  • Maybe this...http://stackoverflow.com/questions/5248183/html-partial-vs-html-renderpartial-html-action-vs-html-renderaction? – drooksy Jul 16 '15 at 23:34
  • That just shows how it should be used. I've used it before in previous versions of MVC. I'm just redesigning a website and wanted to do it in ASP.NET 5 but I haven't been able to find the Partial function. – Pallas Jul 16 '15 at 23:38
  • Understood. Have you tried @Html.RenderPartial? Contextually it could make sense. Can you post your code? – drooksy Jul 16 '15 at 23:40
  • Yes, it doesn't show up either. I added the code for my HTML file that I'm trying to load using the partial. There's not really any other code to add because as I said when I type `@Html.P` the Partial and RenderPartial functions are not in the list. – Pallas Jul 17 '15 at 00:02

1 Answers1

3

@Html.Partial is definitely still there. However, I'd recommend using @await Html.PartialAsync(...) or @{ await Html.RenderPartialAsync(...) }.

enter image description here

The Html.Partial method is located in the Microsoft.AspNet.Mvc.Rendering namespace as an IHtmlHelper extension in the Microsoft.AspNet.Mvc.Core assembly (pulled in by Microsoft.AspNet.Mvc) for beta4.

What you might be seeing is if you type @Html. without pressing the P immediately the Razor editor will treat the . as an end of sentence period until you stop typing for a bit.

Hopefully this helps!

N. Taylor Mullen
  • 18,061
  • 6
  • 49
  • 72
  • 1
    I've got the `Microsoft.AspNet.Mvc` package in my project.json. Any idea why I'm still not seeing these functions? I also tried to use the functions you suggested but none of them show up. All the Intellisense is suggesting is HTML5 tags. – Pallas Jul 16 '15 at 23:53
  • @RandomlyKnighted Ignore the Intellisense for a moment and just try to run it. Do you get a compiler or runtime error? – mason Jul 17 '15 at 00:09