Articles → ASP.NET CORE → Page Model In ASP.NET Core

Page Model In ASP.NET Core






Purpose





Benefit Of The Page Model




  1. Since business logic and UI elements are in separate files, maintaining the code is simpler.
  2. It offers developers the flexibility to work separately on views and page models.
  3. The page model class enables automated unit testing.

How Is The Page Model Specified In The View?




Picture showing the Page model name inside the view file
Click to Enlarge



Picture showing the page model class in the code behind
Click to Enlarge


Method To Write Business Logic




  1. OnGet
  2. OnPost
  3. OnPut


public void OnGet() {

}

public void OnPut() {

}

public void OnPost() {

}




Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, June 1, 2021

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250