title: How to return a partial view in .net core 3
body: <p>Returning partial view in core seems different to mvc5 so anyone can help,
  index view is working perfectly but, i returned the partial view without my layout or anything of index view nothing at all only the products</p>
  
  <pre><code>        [HttpPost]
          public async Task&lt;PartialViewResult&gt; Filter(List&lt;int&gt; categorySearch, int page = 1)
          {
              var items = await _context.ItEntity.Include(i =&gt; i.CaRelation).Include(i =&gt; i.FaRelation).Include(i =&gt; i.ITImages)
                  .Where(x =&gt; categorySearch.Contains(x.CategoryId) || categorySearch.Count == 0).ToListAsync();
              var VMItems = new List&lt;ShopVM&gt;();
              items.ForEach(it =&gt; VMItems.Add(new ShopVM
              {
                  ItemsId = it.Id,
                  ITName = it.ITName,
                  Description = it.Description,
                  CaRelation = it.CaRelation,
                  CategoryId = it.CategoryId,
                  FaRelation = it.FaRelation,
                  FactoryId = it.FactoryId,
                  Image = it.ITImages.FirstOrDefault().ImName
              }));
              var model = PagingList.Create(VMItems.AsQueryable().AsNoTracking().OrderByDescending(s =&gt; s.ItemsId), 20, page);
  
              var myViewData = new ViewDataDictionary(new EmptyModelMetadataProvider(), new ModelStateDictionary()) { Model = model };
              PartialViewResult result = new PartialViewResult()
              {
                  ViewName = "_SearchPro",
                  ViewData = myViewData,
              };
  
              return result;
          }
  </code></pre>
  
  <p>here's my partial view returning paginglist foreach of items</p>
  
  <pre><code>@model ReflectionIT.Mvc.Paging.PagingList&lt;DaryDress.ViewModel.ShopVM&gt;
  @using ReflectionIT.Mvc.Paging
  @addTagHelper *,ReflectionIT.MVC.Paging
  
  
  @foreach (var item in Model)
  {
      &lt;div class="col-sm-12 col-md-6 col-lg-3 ftco-animate"&gt;
          &lt;div class="product"&gt;
              @if (item.Image != null)
              {
                  &lt;a asp-controller="Main" asp-action="Product" asp-route-id="@item.ItemsId" class="text-center img-thumbnail img-prod"&gt;&lt;img class="img-fluid img-rounded" style="height:300px; cursor:pointer;" src="~/Images/@item.Image" /&gt;&lt;/a&gt;
              }
              &lt;div class="text py-2 px-3"&gt;
                  &lt;a asp-controller="Main" asp-action="Product" asp-route-id="@item.ItemsId"&gt;&lt;h3 style="width:100%; text-align:center;" id="itemname" class="font-weight-bold"&gt;@item.ITName&lt;/h3&gt;&lt;/a&gt;
                  &lt;div class="d-flex"&gt;
                      &lt;div style="width:100%; text-align:center;" class="pricing"&gt;
                          &lt;p style="width:100%; text-align:center;" class=" font-weight-bold price"&gt;&lt;span&gt;@item.FaRelation.FaName&lt;/span&gt;&lt;/p&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;hr&gt;
                  &lt;p class="bottom-area d-flex"&gt;
                      &lt;a href="#" class=" font-weight-bold add-to-cart"&gt;&lt;span&gt;@item.CaRelation.CaName&lt;i class="ion-ios-add ml-1"&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;
                  &lt;/p&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
              }
  </code></pre>
  
  <p>here's my index with layout, some divs and returning items as html.partial</p>
  
  <pre><code>@model ReflectionIT.Mvc.Paging.PagingList&lt;DaryDress.ViewModel.ShopVM&gt;
  @using ReflectionIT.Mvc.Paging
  @addTagHelper *,ReflectionIT.MVC.Paging
  
  
  @{
      Layout = "_LayoutPro";
  }
  
  &lt;!DOCTYPE html&gt;
  &lt;html lang="ar-eg"&gt;
  
  &lt;body&gt;
      &lt;div class="hero-wrap hero-bread" style="background-image: url('/images/bg_6.jpg');"&gt;
          &lt;div class="container"&gt;
              &lt;div class="row no-gutters slider-text align-items-center justify-content-center"&gt;
                  &lt;div class="col-md-9 ftco-animate text-center"&gt;
                      &lt;h1 class="mb-0 bread"&gt;المـنـتـجات&lt;/h1&gt;
                      &lt;p class="breadcrumbs"&gt;&lt;span class="mr-2"&gt;&lt;a href="@Url.Action("Main","Main")"&gt;الرئيسية&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  
  
      &lt;section class="ftco-section ftco-animate bg-light"&gt;
          &lt;div class="container-fluid"&gt;
              &lt;form asp-controller="Store" asp-action="Filter" data-ajax="true" data-ajax-update="#ProductsFilter" data-ajax-mode="replace" data-ajax-method="post"&gt;
                  &lt;div id="li-search" style="float:right; padding-bottom:5px; background: lightpink; border-radius: 25px;" class="col-lg-2"&gt;
                      &lt;div class="sidebar-categories"&gt;
                          &lt;div style="color:black; text-align: center; font-size: x-large; font-weight: 600;" class="head"&gt; الفئات&lt;/div&gt;
                          &lt;hr /&gt;
                          &lt;div action="#"&gt;
                              &lt;ul style="text-align:right;direction: rtl; margin-right: -30px; list-style:none;"&gt;
                                  @foreach (var item in ViewBag.categoryList)
                                  {
                                      &lt;li style="list-style:none; padding:0; display:block;" class="filter-list"&gt;
                                          &lt;input id="ProductsCheckbox" class="custom-checkbox" type="checkbox" checked="@item.IsSelect" value="@item.Id" name="CategorySearch"&gt;&lt;label style="color:grey; margin-right:4px" ;&gt;@item.CaName&lt;/label&gt;
                                      &lt;/li&gt;
                                  }
                              &lt;/ul&gt;
                              &lt;input id="btn-search" type="submit" class="btn btn-dark btn-lg" value="بحث" style="display:block; border:solid 1px white; margin:auto; color:pink;" /&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/form&gt;
  
  
              &lt;form id="ProductsFilter" asp-controller="Store" asp-action="Index" method="get"&gt;
                  &lt;div class="col-lg-10 row"&gt;
                          @Html.Partial("_SearchPro")
                  &lt;/div&gt;
              &lt;/form&gt;
          &lt;/div&gt;
      &lt;/section&gt;
  
      &lt;nav id="pagingList" aria-label="Item Paging"&gt;
          &lt;div class="navbar-nav"&gt;
              @await this.Component.InvokeAsync("Pager", new { pagingList = this.Model })
          &lt;/div&gt;
      &lt;/nav&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>