gpt4 book ai didi

c# - 如何在 MVC 中使用 Page_Load 函数

转载 作者:行者123 更新时间:2023-11-30 21:52:51 24 4
gpt4 key购买 nike

以前在 aspx 中我们有

protected void Page_Load(object sender, EventArgs e)
{
}

处理所有页面加载事件的函数。但我不知道如何在 MVC 中使用它。有人可以帮忙吗!

最佳答案

ASP.NET MVC 不适用于 ASP.Net 等事件。没有 PageLoad 事件。您的 Controller 操作方法对应于发送到服务器的请求或 View 。您需要在 HTML 中构建等效控件,然后使用 FORM 将数据通过 HttpPost 发送到服务器,由 Controller 方法。类似地,HttpGet 用于使用 Controller 方法获取数据。

I suggest you this link to get started with MVC

关于c# - 如何在 MVC 中使用 Page_Load 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34409294/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com