Calling a page on another Asp.net-core

Asked

Viewed 65 times

0

Good morning, I have an Edit Timetable page, which works perfectly, but on this Edit page, I need to call the Horario Item Index page, I’m trying this way on the EDIT page :

<div class="row">
    <div class="col-md-offset-2 col-md-10" id="replacetarget">
        @await Component.InvokeAsync("HorarioItem/Index", new { id = Model.Horarios.Id});
    </div>
</div>

But it returns me the following error:

Invalidoperationexception: A view Component named 'Scheduleitem/Index' could not be found. A view Component must be a public non-abstract class, not contain any Generic Parameters, and either be Decorated with 'Viewcomponentattribute' or have a class name ending with the 'Viewcomponent' suffix. A view Component must not be Decorated with 'Nonviewcomponentattribute'.

How can I proceed ? Thank you.

  • she is a partial view @mariana?

  • I’m learning the language now and I’m still picking up a lot, I created the pages with crud Razors, and was created the index page, of item schedule, which is what I need to call.

  • You need to search on Partial View in Aspnet this is the way, do a Viewcomponent in this case may not be ideal...

  • 1

    Do you have any material that can help me ? I would have to create another page for partial view ?

  • For example: https://developmentberto.org/2015/06/04/asp-net-partial-views-razor-mvc-c/ and https://docs.microsoft.com/pt-br/aspnet/core/mvc/views/partial?view=aspnetcore-2.0 this second is the official documentation

  • In my look I do not have these options the project is developed in . NET Core 2.0 Utilizo Page Razor

  • There’s Mariana ... it’s the same

  • He gives me the option only to create a Pagerazor, he won’t let me create a VIEW, how weird. As I am new in this specialty, I do not know if it is due core or not.

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.