I am using asp.net core 2.1. 

My Main page in under Pages folder and my partial view which is \_test2 is in shared folder.
This is my Main page:

```
public class MainModel : PageModel
    {
        public IRepositoryStudent irep;
        public MainModel (IRepositoryStudent _irep){
         irep = _irep;
        }
        [BindProperty]
        public Student student{ get; set; }

        public void OnGet()
        {
            student = irep.GetFirst();
        }
    }

```

This is my Main.cshtml:

```
@page
@model APWeb.Pages.MainModel

<h2>Main</h2>
<partial name="_test2" model="Model.student" />

```

This is my partial view : \_test2:

```
@page
@*
    For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
*@

@model Student
@{ 
<h1 >@Model.Name</h1>}

```

my model in partial view is null and I have this error:

```
NullReferenceException: Object reference not set to an instance of an object.
APWeb.Pages.Shared.Pages_Shared__test2.get_Model()

```

Any help will be appreciate.