- C# 7 and .NET Core 2.0 High Performance
- Ovais Mehboob Ahmed Khan
- 127字
- 2021-08-27 18:47:09
ASP.NET Core Razor Pages
Razor syntax-based pages have been introduced in ASP.NET Core. Now, developers can develop applications and write syntax on the HTML with no controller in place. Instead, there is a code behind file where other events and logic can be handled. The backend page class is inherited from the PageModel class and its member variables and methods can be accessed using the Model object in Razor syntax. The following is a simple example that contains the GetTitle method defined in the code-behind class and used in the view page:
public class IndexModel : PageModel { public string GetTitle() => "Home Page"; }
Here is the Index.cshtml file that displays the date by calling the GetCurrentDate method:
@page @model IndexModel @{ ViewData["Title"] = Model.GetTitle(); }
推薦閱讀
- 數據庫應用實戰
- 數據分析實戰:基于EXCEL和SPSS系列工具的實踐
- Hands-On Machine Learning with Microsoft Excel 2019
- 算法競賽入門經典:習題與解答
- Mastering Ninject for Dependency Injection
- Python數據分析、挖掘與可視化從入門到精通
- 數據庫應用基礎教程(Visual FoxPro 9.0)
- 軟件成本度量國家標準實施指南:理論、方法與實踐
- Remote Usability Testing
- 數據分析師養成寶典
- 大數據技術原理與應用:概念、存儲、處理、分析與應用
- openGauss數據庫核心技術
- 利用Python進行數據分析(原書第2版)
- NoSQL數據庫原理(第2版·微課版)
- MySQL性能調優與架構設計