title: partial page model on post handler is not executing | ASP.NET Core Razor Pages 2.0
body: <p>I have a partial view with a page model. In the page model class I have the OnPost handler which is not being called when the form is submitted.</p>
  
  <p><strong>_Subscribe.cshtml</strong></p>
  
  <pre><code>@page
  @model Shared._SubscribeModel
  
  &lt;div id="subscribe-for-updates"&gt;
      &lt;h4&gt;Subscribe to keep up-to-date with any changes.&lt;/h4&gt;
      &lt;form method="post"&gt;
          &lt;input type="email" name="email" placeholder="yourname@example.com" /&gt;
          &lt;input type="submit" value="Subscribe"/&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>_Subscribe.cshtml.cs</strong></p>
  
  <pre><code>public class _SubscribeModel : PageModel
  {
          public void OnGet()
          {
  
          }
  
          public async Task&lt;IActionResult&gt; OnPostAsync(string email)
          {
              if (!ModelState.IsValid)
              {
                  return Page();
              }
  
              await Task.Run(() =&gt;
              {
                  //do something
              });
  
              return RedirectToPage();
          }
  }
  </code></pre>
  
  <p>Now, the partial view is being rendered in the home page.</p>
  
  <p><strong>Index.cshtml</strong></p>
  
  <pre><code>@page
  @model IndexModel
  @{
      ViewData["Title"] = "Welcome";
  }
  
  &lt;h2&gt;Hello, Welcome to my website!&lt;/h2&gt;
  
  &lt;partial name="_Subscribe" model="Model.SubscribeModel" /&gt;
  </code></pre>
  
  <p><strong>Index.cshtml.cs</strong></p>
  
  <pre><code>public class IndexModel : PageModel
      {
          public IndexModel()
          {
              SubscribeModel = new _SubscribeModel();
          }
  
          public _SubscribeModel SubscribeModel { get; }
  
          public void OnGet()
          {
  
          }
      }
  </code></pre>
  
  <p>I did some research and found out that the code behind partial views is not automatically executed like normal pages which means that I have to explicitly call OnPost but this seems wrong. </p>
  
  <p>Am I doing something wrong?</p>
  
  <p>Any help would be appreciated.</p>