- 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(); }
推薦閱讀
- DB29forLinux,UNIX,Windows數(shù)據(jù)庫管理認(rèn)證指南
- 正則表達(dá)式必知必會
- 大數(shù)據(jù)導(dǎo)論
- 醫(yī)療大數(shù)據(jù)挖掘與可視化
- UDK iOS Game Development Beginner's Guide
- Ceph源碼分析
- 大數(shù)據(jù)精準(zhǔn)挖掘
- Solaris操作系統(tǒng)原理實驗教程
- Oracle數(shù)據(jù)庫管理、開發(fā)與實踐
- 計算機(jī)視覺
- 信息融合中估計算法的性能評估
- Deep Learning with R for Beginners
- AndEngine for Android Game Development Cookbook
- Redis 6開發(fā)與實戰(zhàn)
- Learn Selenium